-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Add focus visibility on tabs with pills #32357
Conversation
I think this should specifically target only the pills nav links, as this PR in its current form affects all nav links - see, for instance, the top navigation in the header (Home, Docs, Examples ...) https://deploy-preview-32357--twbs-bootstrap.netlify.app/ |
@patrickhlauke changes where made, let me know if another change is needed |
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.
We shouldn't be setting focus styles (the box-shadow) on hover. Will review in more depth likely after beta 2.
@mdo I left it just with the focus. Let me know if it is the correct approach. |
well, it was just replicating what buttons do...i personally wouldn't have minded. |
beyond that though, https://deploy-preview-32357--twbs-bootstrap.netlify.app/docs/5.0/components/navs-tabs/ looks good to me |
@mdo is the anything else needed ? Thank you! |
ah gotcha, we can fix it just for the pill ones, yes |
Hi guys I did this minor change but I am having trouble with the tests, as I left it I think I need a rebase or something ( I try but still gives an error ) any help ? 😅 |
i think you forgot to |
Haven't looked at it too close, but it seems like the outline results in duplicate borders for active tabs and -1px or so for inactive ones. |
not sure i'm following what you're seeing. which browser? which example specifically? got a screenshot/pointer to it? |
Sorry, for the late reply. I probably mixed the examples and I was looking at the It works, but the focus style seems to overlap with the other nav-items. Edit: also browsers seem to have their own focus styles already, and with this patch we will have an inconsistent style in nav-tabs? |
Yeah I think there's no clean way around this. As that overlapping focus style only shows for keyboard users as they navigate through, and momentarily (before either the link is followed or, in case of dynamic tabs, when that tab then becomes active) it's something I think is not completely deal-breaking (otherwise we have to start moving to inner shadows or something rather that box shadows)
If you go to https://getbootstrap.com/docs/5.0/components/navs-tabs/#pills with Firefox (at least on Windows), there's no visible default focus indication. See this animation where I go back and forth with With this change, it's at least consistent across all browsers. Leaving it up to browser default in this case is not a good idea, because of this variability (while yes, Chrome for instance has very clear default focus outline).
You mean inconsistency between the regular |
All right, let's wait for @twbs/css-review to have a look. I'd swear there was some kind of CSS property we recently used in another RP . |
ah, you might be thinking of https://developer.mozilla.org/en-US/docs/Web/CSS/isolation ... hmm, this may help yes, but not sure how the semi-transparent box shadow over the active pill would show, if at all |
@XhmikosR @patrickhlauke Just tried, it doesn't help there since our There might be other approaches but I'm unable to find one for now. |
I'd vote to just keep it simple and consistent for the time being :) |
This has slipped a bit off our radar... @mdo and @twbs/css-review in general, what are your feelings on this? it's probably not perfect for all circumstances, but does patch a gap in accessibility we currently have. |
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, not perfect but a good patch for now 👌
Focus styles are a whole topic deserving closer attention.
@twbs/css-review may we put this on a following project or close it? |
Focus styles coming in #33125. |
Fixes #31427
Proposal: add the scss variables for the focus
Preview: https://deploy-preview-32357--twbs-bootstrap.netlify.app/docs/5.0/components/navs-tabs/#javascript-behavior