-
Notifications
You must be signed in to change notification settings - Fork 779
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
fix(frame-focusable-content): don't fail for elements with negative tabindex #3493
Conversation
@@ -45,13 +45,6 @@ describe('frame-focusable-content tests', function() { | |||
assert.isTrue(frameFocusableContent(null, null, vNode)); | |||
}); | |||
|
|||
it('should return false if element is natively focusable but has tabindex', function() { |
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.
Turns out IE11 will take the empty tabindex
and default it to -3876
. But that value of tabindex also didn't prevent the browser from tabbing to the element so ¯\(ツ)/¯
* @method isFocusable | ||
* @memberof axe.commons.dom | ||
* @instance | ||
* @param {HTMLElement} el The HTMLElement | ||
* @return {Boolean} The element's focusability status | ||
*/ | ||
|
||
function isFocusable(el) { | ||
export default function isFocusable(el) { |
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.
I wonder if maybe we should add some option here to say isFocusable(el, { noNegativeTabindex: true })
?
This seem like sort of a common occurance.
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.
I agree. Though maybe the option could be called programmatically
? Either way we should do it in a separate pr.
const focusable = isFocusable(el, { programmatically: false })
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.
Created #3500
var vNode = queryFixture('<button id="target"><span>Hello</span></button>'); | ||
var vNode = queryFixture('<div id="target"><span>Hello</span></div>'); |
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.
Why did you have to change these?
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.
having the frame-focusable-content test have all the elements wrapped in buttons was strange so changed them to divs
The <button><a></a></button>
setup was the one that was the most strange
Co-authored-by: Wilco Fiers <[email protected]>
…abindex (#3493) * fix(frame-focsuable-content): don't fail for elements with negative tabindex * revert playground' * remove test case * Update lib/checks/keyboard/frame-focusable-content-evaluate.js Co-authored-by: Wilco Fiers <[email protected]> Co-authored-by: Wilco Fiers <[email protected]>
Updated the
isFocusable
code since we were looking at it to 1) default export at top and 2) update the description as we spent a bit of time trying to figure out why an element with tabindex=-1 was still considered focusable.Also, having the
frame-focusable-content
test have all the elements wrapped inbuttons
was strange so changed them todivs
Closes issue: #3466