Skip to content
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 option to isFocusable to take into account negative tabindex #3500

Closed
straker opened this issue Jun 3, 2022 · 1 comment
Closed

add option to isFocusable to take into account negative tabindex #3500

straker opened this issue Jun 3, 2022 · 1 comment
Assignees
Labels
commons Issues in the common code (lib/commons) feat New feature or enhancement good first issue For first-time contributors pr A pr has been created for the issue

Comments

@straker
Copy link
Contributor

straker commented Jun 3, 2022

The isFocusable function currently does not take into account negative tabindex (and for the default use case it shouldn't take into account negative tabindex). This causes us to pair the function call with a check on tabindex to ensure that the element is currently keyboard focusable and not programmatically focusable.

const tabindex = vNode.attr('tabindex');
if ((isNaN(tabindex) || tabindex >  -1) && isFocusable(element)) {
  // ...
}

We should add an option to the function that enables looking for negative tabindex and changes the return to false for the element. Something like programmatically: false or noNegativeTabindex: false.

if (isFocusable(element, { programmatically: false }) {
  // ...
}
@straker straker added feat New feature or enhancement commons Issues in the common code (lib/commons) good first issue For first-time contributors labels Jun 3, 2022
@straker straker changed the title add option to isFocusable to take into account for negative tabindex add option to isFocusable to take into account negative tabindex Jun 6, 2022
dbowling added a commit that referenced this issue Aug 16, 2022
- add option arg that enables looking for negative tabindex (defaults to false)

references: #3500
@dbowling dbowling added the pr A pr has been created for the issue label Aug 16, 2022
dbowling added a commit that referenced this issue Aug 22, 2022
- add option arg that enables looking for negative tabindex (defaults to false)

references: #3500
dbowling added a commit that referenced this issue Aug 24, 2022
add option arg that enables looking for negative tabindex (defaults to false)

references: #3500
dbowling added a commit that referenced this issue Aug 30, 2022
* add commons.isInTabOrder()
* replace uses of isFocusable with isInTabOrder when isFocusable also checked for negative tabindex

references: #3500

Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
Co-authored-by: Steven Lambert <2433219+straker@users.noreply.github.com>
@padmavemulapati
Copy link

Validated using latest develop branch code base,
If negative tab index is there within the frame it is failing but if it is in focussible area, then it is ignoring
Script:

<script src="/axe.js"></script>

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commons Issues in the common code (lib/commons) feat New feature or enhancement good first issue For first-time contributors pr A pr has been created for the issue
Projects
None yet
Development

No branches or pull requests

3 participants