#52006 closed defect (bug) (fixed)
Twenty Twenty-One: anchor links don't work in mobile menu
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.6.1 | Priority: | normal |
Severity: | normal | Version: | 5.6 |
Component: | Bundled Theme | Keywords: | has-patch, fixed-major, twenty-twenty-one-1.1 |
Focuses: | javascript | Cc: |
Description
Hi there, similar to #48916 anchor links are broken in the mobile menu, they just don't go anywhere.
This is a handy use case when you want your nav menu to link to further options in the footer widgets.
I have tested this on two different WordPress 5.6 sites, both running Twenty Twenty One 1.0.
Attachments (1)
Change History (12)
#1
@
4 years ago
- Focuses javascript added
- Keywords has-patch added
I am able to reproduce the problem.
This is an initial patch with code adapted from Twenty Twenty.
We don't need to consider anchor links outside the menu since the responsive menu is full screen.
How this was tested:
Added a HTML widget with a target ID to the footer widget area.
Added two anchor links to the primary menu, one as a parent menu item, and the second as a sub menu item.
Reduced the browser window width and clicked on the different anchor links in the menu.
Windows 10, Chrome Version 87.0.4280.88. Firefox 83.0.
The patch still needs to be tested on a touch device.
-The scroll to the target is very fast and this could perhaps be improved to feel more like a natural scroll.
#2
@
4 years ago
Excellent! I can confirm that your patch works for Safari on an iPhone 12 running iOS 14.2.1.
Close menu and scroll to anchor if an anchor link is clicked.