Changes between Initial Version and Version 2 of Ticket #57915
- Timestamp:
- 03/13/2023 08:30:44 PM (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #57915
- Property Component Menus → Themes
- Property Focuses javascript added
-
Ticket #57915 – Description
initial v2 1 This code in /wp-includes/blocks/navigation/view-modal.min.js closes the hamburger navigation menu when a regular bookmark link (starting with #) is clicked:1 This code in `/wp-includes/blocks/navigation/view-modal.min.js` closes the hamburger navigation menu when a regular bookmark link (starting with `#`) is clicked: 2 2 3 3 … … 18 18 19 19 20 This is great, but bookmark links starting with # will only work if the bookmark is on the current page a simple # link won't work. A /# link (with a slash) will work on the other hand - it will navigate to the homepage, and then scroll to the section. For example: /#some-section (instead of #some-section)20 This is great, but bookmark links starting with `#` will only work if the bookmark is on the current page a simple `#` link won't work. A `/#` link (with a slash) will work on the other hand - it will navigate to the homepage, and then scroll to the section. For example: `/#some-section` (instead of `#some-section`) 21 21 22 If the visitor is on the homepage, such a link with a / will work the same as a link without a /- scrolling to the section, without reloading the page. This makes it a perfect catch-all solution.22 If the visitor is on the homepage, such a link with a `/` will work the same as a link without a `/` - scrolling to the section, without reloading the page. This makes it a perfect catch-all solution. 23 23 24 But, clicking such a link ( /#) won't close the hamburger navigation menu on mobile, as the JavaScript code above only catches links starting with # (and not /#). This can be easily fixed by adding another OR condition: ||!t.startsWith("/#") or maybe even replacing the current condition with a "includes" condition, to catch both cases with one condition: ||!t.includes("#")24 But, clicking such a link (`/#`) won't close the hamburger navigation menu on mobile, as the JavaScript code above only catches links starting with `#` (and not `/#`). This can be easily fixed by adding another OR condition: `||!t.startsWith("/#")` or maybe even replacing the current condition with a "includes" condition, to catch both cases with one condition: `||!t.includes("#")` 25 25 26 26 Thanks,
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)