[wp-trac] [WordPress Trac] #53619: Twenty Twenty-One: JS Error for Anchors that load custom modals or react hash routes
WordPress Trac
noreply at wordpress.org
Mon Oct 4 16:47:24 UTC 2021
#53619: Twenty Twenty-One: JS Error for Anchors that load custom modals or react
hash routes
-------------------------------------------------+-------------------------
Reporter: rixeo | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.9
Component: Bundled Theme | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs- | Focuses: javascript
testing-info |
-------------------------------------------------+-------------------------
Comment (by rixeo):
- In the WordPress admin backend, navigate to Appearance > Menus
- Select a menu that shows in the "Primary Menu" Display Location. If
there is no new menu, create a new one and assign is to the "Primary Menu"
under Display Location
- Under the "Add menu items" section, expand the sub-section "Custom
Links"
- In the field URL, add something like `#test`
- In the Field Link Text ass something like "Sample Link"
- Click the Button `Add To Menu` to add the item to your menu
- Click `Save Menu` which should be on the right near the bottom
- Visit your WordPress site frontend and click on the custom link
- Open your browser console
(https://balsamiq.com/support/faqs/browserconsole/), select the console
tab
- Now click the custom link in the navigation menu
- Before the fix, there should be an error shown in the browser console
that starts with : `Uncaught TypeError: anchor is null`
Replying to [comment:6 hellofromTonya]:
> Replying to [comment:5 rixeo]:
> > sure :) You can add a custom nav menu that points to a custom hash.
Clicking it on the frontend will trigger the error
For more help on the navigation menu, please visit
https://codex.wordpress.org/WordPress_Menu_User_Guide
>
> Thank you.
>
> The term "custom hash" may be unfamiliar for contributors. I assume it's
referring to an anchor that links to specific spot in a web page. Is this
correct?
>
> What could be helpful is to provide the setup instructions that guide
testers to prepare for testing when a "custom hash" exists and when it
doesn't exist.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53619#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list