Opened 7 years ago
Closed 3 years ago
#41050 closed defect (bug) (duplicate)
Twenty Seventeen: Cannot read property 'top' of undefined in belowEntryMetaClass
Reported by: | ericdaams | Owned by: | |
---|---|---|---|
Milestone: | 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 (7)
#3
@
5 years ago
- Summary changed from Cannot read property 'top' of undefined in belowEntryMetaClass (TwentySeventeen) to Twenty Seventeen: Cannot read property 'top' of undefined in belowEntryMetaClass
#4
@
3 years ago
Sorry the ticket did not receive more attention earlier.
This looks like the issue on #53512, which was just fixed for WordPress 5.8. Please verify whether it works now.
#5
@
3 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
I was hoping for confirmation that the issue is fixed now, but I'll close the ticket as a duplicate of #53512.
If I'm wrong (about this) and the problem still occurs, please reopen the ticket.
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.