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
fix focusable custom-element tabbing issue #1072
fix focusable custom-element tabbing issue #1072
Conversation
🦋 Changeset detectedLatest commit: 8511822 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 |
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.
Thank you for this PR! I appreciate you tried to follow all the existing repo patterns, and it's good to add the all-contributors
package script.
For testing, I don't think we can do more than what you've done because of Cypress' lack of support for Shadow DOM.
I ran the demo locally, and the usual active focus trap styling isn't working after your changes (the trap's container should get a pinkish background like all the other demos when the trap is active). Also, it would be nice if the tabbable <custom-content>
element you added would get the usual teal border around it when it has focus.
Co-authored-by: Stefan Cameron <stefan@stefcameron.com>
Fixed everything you pointed out in the review, this is how the focus states look now: Focus demoScreen.Recording.2023-10-10.at.10.02.09.movI added a focus ring around the whole element, as it's now focusable because of the |
Nice, thank you! The demo looks great now in your video. I'll check out your changes ASAP! |
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.
Nice! Thank you for this PR. Everything looks good to me. 😄
fixes #1068
Added a function that recursively checks for the
activeElement
and if theactiveElement
is a custom-element, it pierces the shadow-dom and checks foractiveElement
in it to determine which element is truly in focus.I was not sure how to properly test this as imo it's very much an edge case, so for now I just updated the current
in-open-shadow-dom
example to have the structure I described in the issue and manually checked if my changes fix that. I have not written any extra tests for now, but if you think that new tests are warranted, I'm happy to add themaside: I also added an
all-contributos
script topackage.json
, as according to to cotribution docs it already should've been there.PR Checklist
Please leave this checklist in your PR.
npm run demo-bundle
in your branch and include the/docs/demo-bundle.js
file that gets generated in your PR).// TEST MANUALLY
comments here) that can't be fully tested in Cypress have been manually verified.typeof document/window !== 'undefined'
before using it in code that gets executed on load.npm run changeset
locally to add one, and follow the prompts).