-
Notifications
You must be signed in to change notification settings - Fork 791
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(get-role): add presentation role resolution and inheritance #2281
Changes from 11 commits
c180e70
c0d9fbd
8cc43b9
e67e77b
b0014ce
13a0c17
2eb6719
3761d7e
628ee6e
a31f62d
e1d8250
35fff93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
import matches from '../matches/matches'; | ||
import getRole from '../aria/get-role'; | ||
|
||
const alwaysTitleElements = [ | ||
'button', | ||
'iframe', | ||
'a[href]', | ||
{ | ||
nodeName: 'input', | ||
properties: { type: 'button' } | ||
} | ||
]; | ||
const alwaysTitleElements = ['iframe']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't be necessary. IsFocusable is getting this wrong. For the purpose of what we're doing here, iframes are focusable areas. Unlike other areas they route focus to the first focusable area inside of it, unless there is none in which case you can clearly see iframes are focusable. Take this example: <button>hello</button>
<iframe width="100" height="100"></iframe>
<button>world</button> There is a tab stop between "hello" and "world". It isn't visible, the :focus style doesn't apply, but activeElement is set. Here's where to find it in the HTML spec: https://html.spec.whatwg.org/#bc-focus-ergo-bcc-focus I think what we need to do is update const myFrame = document.querySelector('iframe')
isFocusable(myFrame) // false
isFocusable(myFrame, { focusRouters: true }) // true There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fine, but I think that's outside the scope of this pr. We should create another pr that fixes the iframe issue of isFocusable. |
||
|
||
/** | ||
* Get title text | ||
|
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 just looked these up, as far as I can tell this stuff doesn't work with dl, which is good because otherwise we'd have to deal with div being allowed to group dd / dt elements.
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.
It doesn't work in Chrome but does in Firefox, Safari/VO, and IE11/JAWS:
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 had assumed
<div>
would stop the chain as we've seen in other things, but after testing it does in fact carry through the role inheritance so we'll need to add that.