Opened 4 years ago
Last modified 15 months ago
#41050 new defect (bug)
Twenty Seventeen: Cannot read property 'top' of undefined in belowEntryMetaClass
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.8 |
Component: | Bundled Theme | Keywords: | |
Focuses: | javascript, template | Cc: |
Description
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)
Change History (5)
Note: See
TracTickets for help on using
tickets.
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 thehas-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.