Make WordPress Core

Opened 2 years ago

Last modified 7 months ago

#41050 new defect (bug)

Cannot read property 'top' of undefined in belowEntryMetaClass (TwentySeventeen)

Reported by: ericdaams Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8
Component: Bundled Theme Keywords:
Focuses: javascript, template Cc:
PR Number:


I'm seeing this with TwentySeventeen version 1.3 activated:

global.js?ver=1.0:124 Uncaught TypeError: Cannot read property 'top' of undefined
    at belowEntryMetaClass (global.js?ver=1.0:124)
    at global.js?ver=1.0:239

It only occurs in the following circumstance:

  • You have widgets in the sidebar menu.
  • You have a custom template (either defined in your child theme or generated by a plugin) that does not load the sidebar.

If the above are both true, you'll see the error triggered on the window.resize event.

I first encountered this while testing alongside Charitable (create a campaign and then go to donate page), but you can also reproduce by creating a child theme and adding a custom single.php with the sidebar omitted.

Attachments (2)

41050.patch (620 bytes) - added by ericdaams 2 years ago.
41050.2.patch (583 bytes) - added by ericdaams 2 years ago.

Download all attachments as: .zip

Change History (4)

2 years ago

2 years ago

#1 @ericdaams
2 years ago

I've added two patches, either of which resolves this. The second is a little more efficient since it only checks $sidebar.length instead of also checking for the has-sidebar body class. My assumption is that if $sidebar.length is false, has-sidebar will never exist as a body class anyway, so it's a redundant check.

#2 @williampatton
7 months ago

  • Component changed from Themes to Bundled Theme
Note: See TracTickets for help on using tickets.