Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

[focus] FOCUSABLE_SELECTOR should exclude disabled buttons #30

Closed
chloerice opened this issue Nov 29, 2017 · 1 comment · Fixed by #31
Closed

[focus] FOCUSABLE_SELECTOR should exclude disabled buttons #30

chloerice opened this issue Nov 29, 2017 · 1 comment · Fixed by #31
Assignees
Labels

Comments

@chloerice
Copy link
Member

chloerice commented Nov 29, 2017

Right now, findFirstFocusableNode and findLastFocusableNode will focus disabled nodes. This is problematic because it breaks tabbability. Take for example the Polaris ActionList component when the first list item is disabled:

focusablenode

By changing const FOCUSABLE_SELECTOR = '...,button...'
to const FOCUSABLE_SELECTOR = '...,button:not(:disabled)...'

Tabbability remains intact and behavior is as expected:

focusablenodenotdisabled

I'm wondering if it makes sense to return a disabled node for any of the disableable selectors (a, input, select, textarea)? If not, when I make the PR I'll specify :not(:disabled) on those as well.

@chloerice chloerice self-assigned this Nov 29, 2017
@chloerice chloerice added the bug label Nov 29, 2017
@svinkle
Copy link
Member

svinkle commented Dec 5, 2017

a doesn't have a disabled attribute or state.

Adding an additional option for input, select, and textarea should do the trick.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants