• After updating from 2.0 to 2.1, the following error appears in the browser console, breaking any subsequent JS code.

    TypeError: sidebarPos is undefined
    twentyseventeen/assets/js/global.js:124

Viewing 6 replies - 1 through 6 (of 6 total)
  • I am getting exactly the same error, except it only occurs on pages with BBPress on them.

    Firefox gives the error as:

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

    I made a disgustingly bad bodge to get rid of the problem!

    Around line 124 it reads:

    sidebarPos       = $sidebar.offset();
    sidebarPosBottom = sidebarPos.top + ( $sidebar.height() + 28 );

    I just added a check. It’s not tested fully but it appears to work on my site – but there could easily be problems down the line with updates and other issues.

    sidebarPos       = $sidebar.offset();
    if ( sidebarPos === undefined )
    	sidebarPosBottom = ( $sidebar.height() + 28 );
    else
    	sidebarPosBottom = sidebarPos.top + ( $sidebar.height() + 28 );

    But this is something that the theme coders need to sort out and I take no responsibility for it! ??

    I also have this issue when I make a child theme and have the side bar turned off.

    @arathra This is just what I needed, thank you. It is ridiculous that this is necessary.

    I could literally give you a limb right now I’m so ecstatic I found your code. I’ve been wracking my brain for a client trying to get rid of this error and this finally worked. Thank you thank you thank you!

    A limb! Now that’s too generous. Make it a beer and we’d be quits ??

    If you put an empty text widget (no title, nothing) in an empty sidebar, the problem goes away.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘TypeError: sidebarPos is undefined’ is closed to new replies.