Skip to content

Add aria-actions focus handling wording - #2845

Open
smhigley wants to merge 1 commit into
secondary-actionsfrom
actions-focus
Open

Add aria-actions focus handling wording#2845
smhigley wants to merge 1 commit into
secondary-actionsfrom
actions-focus

Conversation

@smhigley

@smhigley smhigley commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🚀 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 preventDefault on 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.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployed on https://deploy-preview-2845--wai-aria.netlify.app

@github-actions
github-actions Bot temporarily deployed to pull request July 16, 2026 00:14 Inactive
@spectranaut

Copy link
Copy Markdown
Contributor

@twilco I can't add you to the review list but if you can take a look

Comment thread core-aam/index.html
<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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread core-aam/index.html
<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>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, same issue as above wrt "event" vs "notification" and "system or accessibility-specific" vs "API"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should not be a comma before the word 'unless':

Suggested change
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>

Comment thread index.html
<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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


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>  

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest changing the initial phrase to clarify both:

  1. that the user is not on the referencing element, the focus is on the referencing element.
  2. The intent is to maintain focus after the action is invoked if doing so is xpected.

Comment thread index.html
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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread index.html
<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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread index.html
</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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")

@smhigley smhigley Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread index.html
</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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@mcking65 mcking65 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a few suggestions. While they effect meaning, I don't think they change the intended meaning.

Comment thread core-aam/index.html
<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>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should not be a comma before the word 'unless':

Suggested change
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>

Comment thread index.html
<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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


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>  

Comment thread index.html
<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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest changing the initial phrase to clarify both:

  1. that the user is not on the referencing element, the focus is on the referencing element.
  2. The intent is to maintain focus after the action is invoked if doing so is xpected.

Comment thread index.html
<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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Comment thread index.html
</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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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>

Comment thread index.html
</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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants