Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global mega menu fails on click events on narrow displays with new Canada.ca look/feel #8620

Open
minorOffense opened this issue Apr 1, 2019 · 1 comment

Comments

@minorOffense
Copy link

minorOffense commented Apr 1, 2019

When using the mega menus on narrow displays the sub menu items throw a javascript error on

( $linkTarget = $( "#" + wb.jqEscape( testHref.substring( 1 ) ) ) ).length !== 0 ) {

You can see the error at https://nrc.canada.ca

What happens is that if testHref is less than 2 characters long you end up with a jQuery selector of just "#" which is invalid in jQuery 3 (jQuery 2 incorrectly returns the main html document element). So the $linkTarget variable assignment causes an error.

Specifically

$( "#" + wb.jqEscape( testHref.substring( 1 ) ) )

Causes the error when wb.jqEscape( testHref.substring( 1 ) ) returns blank.

Instead a check should be made to skip this whole logic block if the testhHref value is just "#"

Patch to come.

@duboisp
Copy link
Member

duboisp commented Apr 4, 2019

PR merged

FYI - That fix are going to be packaged also with the next GCWeb 5.1 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants