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
feat(jump-links)!: reimplement in line with PFv4 #2283
Conversation
🦋 Changeset detectedLatest commit: 434527d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
✅ Deploy Preview for patternfly-elements ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
Thanks @nikkimk ! This should probably get a changeset for adding roving tabindex controller |
|
For the scrollspy demo locally I am not able to navigate with my keyboard to any of the headings other than 1 & 5 (first and last) using the arrow keys. Not sure if that is expected or not but didn't see a disabled attribute on those elements. |
Not sure what you are seeing @brianferry but FWIW I am able to navigate fine with the arrows, home, and end key all working as expected. |
Co-authored-by: Steven Spriggs <steven.spriggs@gmail.com>
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.
LGTM
What I did
@patternfly/pfe-core/controllers/scroll-spy-controller.jsTesting Instructions
Run the demo locally, and check the Deploy Preview
Notes to reviewers
Public APIs/HTML
Keep in mind that the primary goal here is to replicate the pfv4 dx, not to provide a strictly html-first element. Nonetheless, the controller tries not to presume anything about the available DOM, so that it could be useful in implementing a light-dom-heavy version of jump-links in the near future (i.e. rh-jump-links or rh-table-of-contents, whathaveyou).
Try to think ahead to what you'd need to implement an HTML-first / noscript-y version of this, and think if the controller as-is would be enough.
Assumptions made
There are, as far as i can tell, two places where the controller makes assumptions about it's host's light DOM, both regarding this concept of "link children". Link children are the elements in the controller host's light-dom which link to the scrollable content headings. when the content scrolls up and down the page, the link child which represents the current heading should become "active".
hrefattribute which contains a hash reference to its heading (i.e.<a href="#foo">or<pfe-jump-links-item href="#bar">If you find these assumptions to be too restrictive, please speak up.