-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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(tab): Give focus to tab when activated #3164
Conversation
Codecov Report
@@ Coverage Diff @@
## feat/tabs/tabs #3164 +/- ##
=================================================
Coverage ? 98.42%
=================================================
Files ? 113
Lines ? 4821
Branches ? 600
=================================================
Hits ? 4745
Misses ? 76
Partials ? 0
Continue to review full report at Codecov.
|
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.
Are we sure we want to do this in all cases? Couldn't this be really confusing if you're focused e.g. on a part of the page unaffected by tabs, then a tab is activated programmatically and grabs the user's focus?
If the tab is programmatically activated, then the content will change and
I’d think the user would want to be aware that something changed via a
focus adjustment.
Focusing on activation via keyboard navigation is part of the W3 spec for
accessible tabs. That was my goal here: to add support for keyboard
navigable Tabs.
https://www.w3.org/TR/wai-aria-practices/examples/tabs/tabs-1/tabs.html
…On Mon, Jul 23, 2018 at 6:54 AM Kenneth G. Franqueiro < ***@***.***> wrote:
***@***.**** commented on this pull request.
Are we sure we want to do this in all cases? Couldn't this be really
confusing if you're focused e.g. on a part of the page unaffected by tabs,
then a tab is activated programmatically and grabs the user's focus?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3164 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFqhdpo9CfDRY9Dk8YHn2W1ji_odQyoAks5uJdWygaJpZM4VZaso>
.
|
I realize this is about keyboard a11y, but that example seems to be showing almost the reverse of what this is doing: the example activates a tab when it receives focus. This PR focuses a tab when it's activated. There's also another WAI-ARIA example that shows tabs not being activated until space/enter is pressed when they have focus. Our design article seems to show focus states for both activated and unactivated tabs, and our earlier Tabs implementation doesn't activate on focus. Have we talked to a designer about which interaction behavior is intended for Material tabs? I don't see clear guidance on keyboard navigation. Either way, this PR seems potentially backwards - should we be manipulating focus when arrow keys are used in the tab bar and activating based on focus or space/enter, instead of driving activation off of arrow keys? |
I haven’t talked with design yet about interaction behavior but I can
schedule some time to do that.
With regards to tab activation on focus, that’s not quite how it works
since inactive Tabs all have a tabindex of -1 so they can’t manually
receive focus via the tab key. The only way Tabs can receive focus is by
activation through clicking or keyboard navigation. They function similar
to lists in that case where you can’t use the tab key to navigate through
them but instead use the tab key to get to the current active Tab then use
arrow keys to navigate through them.
I’ll see if I can get some info from the GAR folks about how they expect
Tabs to work with keyboard navigation.
…On Mon, Jul 23, 2018 at 8:19 AM Kenneth G. Franqueiro < ***@***.***> wrote:
I realize this is about keyboard a11y, but that example seems to be
showing almost the reverse of what this is doing: the example activates a
tab when it receives focus. This PR focuses a tab when it's activated.
There's also another WAI-ARIA example that shows tabs not being activated
until space/enter is pressed when they have focus. Our design article seems
to show focus states for both activated and unactivated tabs, and our
earlier Tabs implementation doesn't activate on focus. Have we talked to a
designer about which interaction behavior is intended for Material tabs? I
don't see clear guidance on keyboard navigation.
Either way, this PR seems potentially backwards - should we be
manipulating focus when arrow keys are used in the tab bar and activating
based on focus or space/enter, instead of driving activation off of arrow
keys?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3164 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFqhdqnnrO5uV5G7LNsfC1r_HrzIXNXqks5uJemTgaJpZM4VZaso>
.
|
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.
Approving for now in the interest of unblocking tab bar, but my reservations stand and we should check with design on what the intended behavior is.
WIP fixed bg coloring of icons fix(tab-indicator): Use absolute positioning (#2547) WIP start of tab scroller WIP fixed transition duration WIP progress on scroller WIP added demos back chore(tabs): Removed tab scroller feat(tabs): Add tab indicator inside tab (#2565) feat(tab-scroller): Add tab scroller (#2577) Merge master into feat/tabs/tabs (#3096) feat(tab): Update tab color and typography (#3108) docs(tabs): Update metadata and synopses (#3117) feat(tab): Add MDCTabDimensions computation (#3122) feat(tab): Emit selection and activation events (#3139) docs(tabs): Update new READMEs to match standard (#3142) feat(tab): Give focus to tab when activated (#3164) feat(tab): Add mixin for parent positioning; Use mixin in tab scroller (#3179) fix(tabs): Suppress area occupied by scrollbar on platforms that show it (#3149) fix(tab): Remove extraneous padding from the stacked text label in LTR (#3193) feat(tabs): Add missing docs and create helper util API (#3194) Merge master into feat/tabs/tabs (#3227) feat(tab): Update layout; Add fixed-width mixin; Add min-width class (#3220) fix(tab-scroller): Fix incorrect animation stopping scroll value in RTL (#3237) feat(tab-scroller): Add scroll content width method for use in tab bar (#3222) feat(tab): Remove activation event emitting (#3242) feat(tab-bar): Add tab bar (#3229)
tl;dr: Can this behaviour be optional/configurable please? I am implementing MDC components on a onepage website and (mis)using the tabs as a navigation element in a fixed header, which will scroll the user to some sections of the page. Additionally, I'm using something like Bootstrap's scrollspy-script to detect whenever the user scrolls to a new section of the page and use Example:
I thought this behaviour could be somehow related to the |
However, it sounds like you have the reverse issue - you're programmatically activating a tab, which gives it focus automatically. Can you log a separate issue for this? We should probably check with our interaction designers on it. |
Ah, I see. You're right. In this case
Jup, that's my issue. :(
I will. |
Closes #3163