#53331 Twenty Twenty-One: Update primary-navigation.js#2833
Closed
carolinan wants to merge 2 commits intoWordPress:trunkfrom
Closed
#53331 Twenty Twenty-One: Update primary-navigation.js#2833carolinan wants to merge 2 commits intoWordPress:trunkfrom
carolinan wants to merge 2 commits intoWordPress:trunkfrom
Conversation
afercia
reviewed
Sep 1, 2022
src/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js
Outdated
Show resolved
Hide resolved
afercia
reviewed
Sep 1, 2022
src/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js
Outdated
Show resolved
Hide resolved
afercia
reviewed
Sep 1, 2022
| wrapper.classList.remove( id + '-navigation-open', 'lock-scrolling' ); | ||
| twentytwentyoneToggleAriaExpanded( mobileButton ); | ||
| // Wait 550 and scroll to the anchor. | ||
| setTimeout(function () { |
Contributor
There was a problem hiding this comment.
Although there's this setTimeout. the page scrolls immediately. This happens because the browser runs the default action: it follows the link and scrolls to the page fragment. We should either prevent the default action with an event.preventDefault() placed before the setTimeout or remove the setTimeout.
afercia
reviewed
Sep 1, 2022
src/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js
Outdated
Show resolved
Hide resolved
mukeshpanchal27
approved these changes
Oct 21, 2022
Member
mukeshpanchal27
left a comment
There was a problem hiding this comment.
@carolinan thank you. LGTM.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Twenty Twenty-One, there is a bug where clicking on an anchor link in the content changes the state of the button that opens and closes the responsive menu.
This PR adds a conditional to check if the clicked anchor link is inside the primary navigation menu (ID site-navigation).
This is to prevent content anchor links from changing the state of the button.
Known limitations: The state of the button is not reset when the browser is resized.
If a menu anchor link is first clicked while on desktop width, and the browser width is reduced, the menu button will show the text "Close" even though the menu is not opened.
Trac ticket: https://core.trac.wordpress.org/ticket/53331
Testing instructions:
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.