Add aria-actions focus handling wording - #2845
Conversation
|
🚀 Deployed on https://deploy-preview-2845--wai-aria.netlify.app |
|
@twilco I can't add you to the review list but if you can take a look |
| <h4 id="ariaActions"><code>aria-actions</code></h4> | ||
| <table aria-labelledby="ariaActions"> | ||
| <p> | ||
| After an action is invoked, browsers MUST NOT fire the API's <a href="#focus_state_event_table">focus event</a> when the referenced action node receives focus. |
There was a problem hiding this comment.
| After an action is invoked, browsers MUST NOT fire the API's <a href="#focus_state_event_table">focus event</a> when the referenced action node receives focus. | |
| After an action is invoked, browsers SHOULD NOT fire the system or accessibility-specific <a href="#focus_state_event_table">focus event</a> when the referenced action node receives focus. |
There was a problem hiding this comment.
Also I think this should be focus "Notification" or "Signals" rather than "Events"? My understanding is that, for most native platform APIs "Event" is referring to an input event like a click (most often user-triggered), but the subsequent broadcasts that goes out over the system would be called "Notifications" on Windows and Apple systems, or "Signals" on GTK.
There was a problem hiding this comment.
I don't have a strong preference here but wanted to note that core-aam already uses the term "Focus event" for these platform mappings. If we want to use "Notification" or "Signals" instead, we should change this everywhere for consistency.
| <table aria-labelledby="ariaActions"> | ||
| <p> | ||
| After an action is invoked, browsers MUST NOT fire the API's <a href="#focus_state_event_table">focus event</a> when the referenced action node receives focus. | ||
| The browser MUST subsequently return DOM focus to the referencing node also without firing an API <a href="#focus_state_event_table">focus event</a>, |
There was a problem hiding this comment.
"subsequently" may be too vague here. does this happen in the same runloop? If not, how long could/should an implementation wait before it's non-compliant?
There was a problem hiding this comment.
Also, same issue as above wrt "event" vs "notification" and "system or accessibility-specific" vs "API"
There was a problem hiding this comment.
There should not be a comma before the word 'unless':
| The browser MUST subsequently return DOM focus to the referencing node also without firing an API <a href="#focus_state_event_table">focus event</a>, | |
| The browser MUST subsequently return DOM focus to the referencing node also without firing an API <a href="#focus_state_event_table">focus event</a> |
| <li>User Agents SHOULD use the accessible names of elements referenced by <code>aria-actions</code> to determine the names of actions that are exposed in a platform accessibility API.</li> | ||
| <li>User Agents MUST NOT expose <code>aria-actions</code> if the Author MUST's are not followed.</li> | ||
| </ul> | ||
| <p>In order to allow users to invoke actions while remaining on the referencing element, browsers MUST do the following steps to manage focus once an action is invoke via the <code>aria-actions</code> API:</p> |
There was a problem hiding this comment.
| <p>In order to allow users to invoke actions while remaining on the referencing element, browsers MUST do the following steps to manage focus once an action is invoke via the <code>aria-actions</code> API:</p> | |
| <p>In order to allow users to invoke actions while remaining on the referencing element, browsers MUST perform the following steps to manage focus once an action is invoked via <code>aria-actions</code>:</p> |
There was a problem hiding this comment.
In addition to the first two editorial diffs here, I wasn't sure "the aria-actions API" sounded quite right to me. I'm not set on that final diff through if you want it back.
There was a problem hiding this comment.
Suggested change:
<p>To prevent unexpected focus change away from the referencing element after users invoke actions, browsers MUST perform the following steps to manage focus once an action is invoked via <code>aria-actions</code>:</p>
There was a problem hiding this comment.
I suggest changing the initial phrase to clarify both:
- that the user is not on the referencing element, the focus is on the referencing element.
- The intent is to maintain focus after the action is invoked if doing so is xpected.
| If the referenced action node is focusable and receives focus as a result of an <code>aria-actions</code> invocation: | ||
| <ul> | ||
| <li>Allow the DOM focus events to fire on the referenced action node as a result of invoking it.</li> | ||
| <li>Do not fire the <a>desktop focus event</a>.</li> |
There was a problem hiding this comment.
| <li>Do not fire the <a>desktop focus event</a>.</li> | |
| <li>Do not fire the <a>system or accessibility-specific focus notification</a>.</li> |
Caveat: keep this in line with whatever prose decision is made above on this same issue.
There was a problem hiding this comment.
this one was a bit on purpose, since the wording "desktop focus event" is used for this elsewhere in the spec & there's a definition for it as well
| <li>Do not fire the <a>desktop focus event</a>.</li> | ||
| </ul> | ||
| </li> | ||
| <li>If focus is moved either programmatically or via a user interaction, handle that focus change as normal, and do not perform any further <code>aria-actions</code> focus steps.</li> |
There was a problem hiding this comment.
If focus is moved either programmatically or via a user interaction,
I presume you're not counting an aria-actions invocation here as a "user interaction" so I would recommend a different term that more clearly excludes it.
handle that focus change as normal
Is there language in the HTML or DOM specs that phrases these more precisely?
There was a problem hiding this comment.
I think if a second aria-actions invocation happened here, then presumably this set of focus steps should be abandoned and that aria-actions focus behavior should be kicked off, so I think it still applies 😅
Still open to better or more precise wording in both cases though
| </ul> | ||
| </li> | ||
| <li>If focus is moved either programmatically or via a user interaction, handle that focus change as normal, and do not perform any further <code>aria-actions</code> focus steps.</li> | ||
| <li>If focus has not moved, the browser MUST move DOM focus back to the referencing element, again without firing a <a>desktop focus event</a>.</li> |
There was a problem hiding this comment.
But focus did move to get here, right? So the "if focus has not moved" clause would never be invoked.
ditto prose for "desktop focus event" (these notifications also aren't limited to "desktops")
There was a problem hiding this comment.
This is the spec definition for "desktop focus event", should we change the wording or add an additional term that shares the same def?
Event from/to the host operating system via the accessibility API, notifying of a change of input focus.
There was a problem hiding this comment.
| <li>If focus has not moved, the browser MUST move DOM focus back to the referencing element, again without firing a <a>desktop focus event</a>.</li> | |
| <li>If the referenced action node is focusable and received focus, move DOM focus back to the referencing element without firing a <a>desktop focus event</a>.</li> |
There was a problem hiding this comment.
This list item needs the same 'if' condition as the first list item. It does not need to state that it is the result of the action invocation or that the browser must do the focus change because those things are stated before the start of the list.
| </li> | ||
| <li>If focus is moved either programmatically or via a user interaction, handle that focus change as normal, and do not perform any further <code>aria-actions</code> focus steps.</li> | ||
| <li>If focus has not moved, the browser MUST move DOM focus back to the referencing element, again without firing a <a>desktop focus event</a>.</li> | ||
| <li>If the referencing element can no longer be focused, the browser MAY keep focus on the referenced action element and fire a <a>desktop focus event</a>.</li> |
mcking65
left a comment
There was a problem hiding this comment.
I've made a few suggestions. While they effect meaning, I don't think they change the intended meaning.
| <table aria-labelledby="ariaActions"> | ||
| <p> | ||
| After an action is invoked, browsers MUST NOT fire the API's <a href="#focus_state_event_table">focus event</a> when the referenced action node receives focus. | ||
| The browser MUST subsequently return DOM focus to the referencing node also without firing an API <a href="#focus_state_event_table">focus event</a>, |
There was a problem hiding this comment.
There should not be a comma before the word 'unless':
| The browser MUST subsequently return DOM focus to the referencing node also without firing an API <a href="#focus_state_event_table">focus event</a>, | |
| The browser MUST subsequently return DOM focus to the referencing node also without firing an API <a href="#focus_state_event_table">focus event</a> |
| <li>User Agents SHOULD use the accessible names of elements referenced by <code>aria-actions</code> to determine the names of actions that are exposed in a platform accessibility API.</li> | ||
| <li>User Agents MUST NOT expose <code>aria-actions</code> if the Author MUST's are not followed.</li> | ||
| </ul> | ||
| <p>In order to allow users to invoke actions while remaining on the referencing element, browsers MUST do the following steps to manage focus once an action is invoke via the <code>aria-actions</code> API:</p> |
There was a problem hiding this comment.
Suggested change:
<p>To prevent unexpected focus change away from the referencing element after users invoke actions, browsers MUST perform the following steps to manage focus once an action is invoked via <code>aria-actions</code>:</p>
| <li>User Agents SHOULD use the accessible names of elements referenced by <code>aria-actions</code> to determine the names of actions that are exposed in a platform accessibility API.</li> | ||
| <li>User Agents MUST NOT expose <code>aria-actions</code> if the Author MUST's are not followed.</li> | ||
| </ul> | ||
| <p>In order to allow users to invoke actions while remaining on the referencing element, browsers MUST do the following steps to manage focus once an action is invoke via the <code>aria-actions</code> API:</p> |
There was a problem hiding this comment.
I suggest changing the initial phrase to clarify both:
- that the user is not on the referencing element, the focus is on the referencing element.
- The intent is to maintain focus after the action is invoked if doing so is xpected.
| <p>In order to allow users to invoke actions while remaining on the referencing element, browsers MUST do the following steps to manage focus once an action is invoke via the <code>aria-actions</code> API:</p> | ||
| <ol> | ||
| <li> | ||
| If the referenced action node is focusable and receives focus as a result of an <code>aria-actions</code> invocation: |
There was a problem hiding this comment.
| If the referenced action node is focusable and receives focus as a result of an <code>aria-actions</code> invocation: | |
| If the referenced action node is focusable and received focus as a result of an <code>aria-actions</code> invocation: |
| </ul> | ||
| </li> | ||
| <li>If focus is moved either programmatically or via a user interaction, handle that focus change as normal, and do not perform any further <code>aria-actions</code> focus steps.</li> | ||
| <li>If focus has not moved, the browser MUST move DOM focus back to the referencing element, again without firing a <a>desktop focus event</a>.</li> |
There was a problem hiding this comment.
| <li>If focus has not moved, the browser MUST move DOM focus back to the referencing element, again without firing a <a>desktop focus event</a>.</li> | |
| <li>If the referenced action node is focusable and received focus, move DOM focus back to the referencing element without firing a <a>desktop focus event</a>.</li> |
| </ul> | ||
| </li> | ||
| <li>If focus is moved either programmatically or via a user interaction, handle that focus change as normal, and do not perform any further <code>aria-actions</code> focus steps.</li> | ||
| <li>If focus has not moved, the browser MUST move DOM focus back to the referencing element, again without firing a <a>desktop focus event</a>.</li> |
There was a problem hiding this comment.
This list item needs the same 'if' condition as the first list item. It does not need to state that it is the result of the action invocation or that the browser must do the focus change because those things are stated before the start of the list.
🚀 Netlify Preview:
🔄 this PR updates the following sspecs:
Closes #2691
This is a PR into the aria-actions branch, not into main. It's split out into its own PR for ease of reviewing this specific update.
I tried to put our agreed-on focus bounce behavior into spec language. In plain language, what happens is:
The browser (not ATs) allow DOM focus to move to the action following the click event, but don't fire API focus events, so screen reader cursors will stay on the referencing element. After a short delay (maybe one tick, maybe a small timeout), browsers will move focus back to the referencing element unless focus has moved somewhere else in the meantime. The API focus event still won't be called, so from a screen reader user's perspective, there have been no focus changes at all. But from a page javascript perspective, the normal events have fired.
I didn't include any wording about what happens if a page author does
preventDefaulton the click or on the first focus event, since that seems too far into the weeds of DOM behavior for ARIA (and more of a JS/eventing concern). Let me know if anyone feels that should be here, though.