-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
modal btn init outline focus style #2065
modal btn init outline focus style #2065
Conversation
🦋 Changeset detectedLatest commit: 4b6fcf1 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@aaronmichaelhappe you're raising some great questions in regards to focus styles in your post above. I do believe this is an area that Skeleton could use a bit more attention. This may be a larger conversation than I'm prepare to dive into today though. Let's try to circle back sometime next week - if you're on Discord feel free to ping me there (username: |
@endigo9740 sounds good. Yes I will be available Tue or Wed and on - ill ping you around then. |
@aaroncrockett I've finally had a chance to sit down and review this PR in full. I like the overall goal - I do agree there should likely be some visualization when something is focused. That aligns well with the ARIA APG guidelines:
Source: https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/ We tend to favor "first focusable" given that this is very simple and predictable. But this does mean there are a few issues with your styles:
Remember we support users generating their own custom modals. What if the button lives outside of I don't have solutions for all these issues, but I wanted to bring that into the conversation here. Additionally, this is sort of a side tangent, but we've run into issues with this approach to accessibility - where a default item is visually highlighted on open. We've had a surprising number of folks report this behavior as a bug for both drawers and popups. After explaining the -why- folks tend to get it, but initially there's a bit of a disconnect in terms of expectations. Perhaps we add a small blurb in our docs explaining why this behaves in this manner? |
Here are some thoughts I have thus far:
Option 2 - Since the issue is related to focusTrap, what about adding a class on the parent element (ie, a focus-trap class)? Or a similar approach? Similar to how in Table component, a class is added within actions.ts. Styles are applied within plugin/styles.
Other |
@aaroncrockett, when talking modals specifically there's no need to append a new class, as known a class is already present. The "windowed" region of the modal (canned or custom) is always wrapped in .modal *:focus:not([tabindex='-1']) { ... } I've refined the selector in a few ways, which might provide more desirable results:
With the general idea to start with the broadest scope, then whittling it down. But not have to specify each type of focusable element that exists. This seems to be providing the expected results in a REPL. Though I'd advise more testing when implemented: |
@aaroncrockett Fridays are my typical PR review days. Just checking in on this. I never heard back after my last message above. |
@endigo9740 Thanks for checking in. I should be able to get to this coming week in time for next PR review. |
@aaroncrockett Sorry for how drawn out this has been. I'm typically quicker to respond but have been short on time lately! Thank you for your patience! Just tested the change and so far this seems to be working to my expectations. I expect some folks will have very strong feelings about this, but I feel this is much closer to modal a11y guidelines. Which is the most important thing. Only two things I would request to finish this off:
I'll then be happy to merge. If you can get this in by Tuesday next week, then this can go out alongside our next release. Thanks again! |
@aaroncrockett thanks for the change. It completely slipped my mind, but the Changeset is missing. Follow the instructions in the original post above to add this.
If you don't get it by Monday I'll jump on this. No worries either way! |
Thank @endigo9740 I did think of this but also noticed these instructions "If you modify files in /packages/skeleton" and assumed since the change was in packages/plugins -- it didn't apply to this. So out of curiosity and for future PRs, what are the conditions under which we run a changesets? I also noticed one of the commands on on the check list was out of date so I'd be glad to update the template as another issue along clarifying when to use changesets, if you would like. |
@aaroncrockett the template instructions pre-date the introduction of |
Linked Issue
#1591
Description
Current Production Behavior:
document.activeElement
correctly points to the button.I am guessing the cause may be to be related to
:focus-visible
, which is not applied until the user interacts with the modal via tab or click. In Firefox, focus styles are never applied when there's just one focusable element. In Chrome, focus styles appear after tabbing to the next element.Changes in PR:
.btn:focus:not(:focus-visible)
to prevent focus styles in undesired situations, such as clicking a button.Changsets
Instructions: Changesets automate our changelog. If you modify files in
/packages/skeleton
, runpnpm changeset
in the root of the monorepo, follow the prompts, then commit the markdown file. Changes that add features should beminor
while chores and bugfixes should bepatch
. Please prefix the changeset message withfeat:
,bugfix:
orchore:
.Checklist
Please read and apply all contribution requirements.
dev
branch (NEVERmaster
)docs/
,feat/
,chore/
,bugfix/
pnpm check
pnpm format
pnpm test