-
Notifications
You must be signed in to change notification settings - Fork 115
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
Allow NavList selection/deselection by id/href in javascript #1822
Conversation
🦋 Changeset detectedLatest commit: 852528b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…onents into nav_list_select_item_id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if @keithamus should look at this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable to me 👍
Description
We currently have logic in dotcom for automatically selecting
NavList
items when navigating via turbo. A lot of this logic depends on the internal HTML structure of theNavList
, which is probably going to break in the near future when I start addressing a11y feedback. Moreover, the existing dotcom behavior doesn't properly expand the parent section if the selected item is a sub item of a section. This PR addresses both concerns by exposing a JavaScript API for selecting items by id, href, or the current URL. A significant portion of this code was copied and tweaked from dotcom.It would be cool to upstream the turbo logic too, but selecting by id relies on setting a
<meta>
tag in the page header, which IMHO isn't something PVC should do.Integration
No, dotcom code should continue to work as expected since none of the underlying HTML is changing. However once this is shipped I will submit a dotcom PR to call our new JavaScript API functions, which will obviate a good deal of dotcom code.
Merge checklist
- [ ] Added/updated documentation- [ ] Added/updated previews