Skip to content

Announce card action buttons as buttons, describe pressed actions as Selected - #5900

Merged
Eugene (OEvgeny) merged 13 commits into
mainfrom
OEvgeny/fix-card-action-pressed-state
Oct 20, 2026
Merged

Eugene (OEvgeny) merged 13 commits into
mainfrom
OEvgeny/fix-card-action-pressed-state

Conversation

@OEvgeny

@OEvgeny Eugene (OEvgeny) commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #5716, fixes #5719, fixes #5745, fixes #5750, addresses #4583

Changelog Entry

Changed

  • 💥 Card action buttons the user pressed are styled with the adaptive-card-renderer__action--selected class instead of [aria-pressed='true']: host CSS that targets .ac-pushButton[aria-pressed='true'] should target .ac-pushButton.adaptive-card-renderer__action--selected instead, in PR #5900, by @OEvgeny

Fixed

  • Fixed #4583, #5716, #5719, #5745, and #5750, card action buttons being announced as toggle buttons, and Submit being marked as selected when the card's inputs fail validation, in PR #5900, by @OEvgeny

Description

Card action buttons had aria-pressed ("toggle button"), and Submit was marked pressed even when validation failed. They are now plain buttons: the action Adaptive Cards performed is described as "Selected" via aria-describedby (#3622) and styled with a class.

Design

  • Marked from onExecuteAction, not a click handler, so actions Adaptive Cards did not perform stay unselected.

Specific Changes

  • useActionShouldBePushButtonModEffect, AdaptiveCardRenderer, en-US.json: mark the executed action, hidden "Selected" text

  • CSS (default, Fluent, style set), cardPushButton* JSDoc: style by class

  • durableAddClassWithUndo: several classes; removed closest ponyfill; comment fixes

  • selectedAction.html (+ Fluent, Copilot): snap 1, "Default" selected

  • selectedAction.validation.html: snap 1, failed Submit unselected; 2, selected once filled

  • ariaPushed.html: snaps 1–7, Yes → No → Submit, ENTER selects it, back to Yes, ENTER selects both

  • hack.actionShouldBePushButtonMod.html, heroCard.pushButton.focusVisible.html: assert "Selected"

  • I have added tests and executed them locally

  • I have added .changelog/<PR#>-<slug>.md

  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

@OEvgeny

Copy link
Copy Markdown
Collaborator Author

I'll do validation tomorrow.

@OEvgeny
Eugene (OEvgeny) force-pushed the OEvgeny/fix-card-action-pressed-state branch 2 times, most recently from dd60494 to 593accf Compare October 19, 2026 00:37
@OEvgeny
Eugene (OEvgeny) force-pushed the OEvgeny/fix-card-action-pressed-state branch 2 times, most recently from 474cde1 to adf6f48 Compare October 19, 2026 08:23
@OEvgeny
Eugene (OEvgeny) marked this pull request as ready for review October 19, 2026 19:29
Copilot AI balanced review requested due to automatic review settings October 19, 2026 19:29

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@OEvgeny

Copy link
Copy Markdown
Collaborator Author
Screenshot 2026-10-19 105836

Eugene Olonov added 6 commits October 19, 2026 15:42
The comments named Action.ShowUrl, but the code exempts buttons with
aria-expanded, which is Action.ShowCard.
…Selected

Card action buttons had aria-pressed, so screen readers announced them as
toggle buttons that never turn off (#5716, #5719, #5745, #5750). They are now
plain buttons; pressed actions are described as "Selected" via
aria-describedby, which keeps the choice announced (#3622), and is styled
via the adaptive-card-renderer__action--selected class instead of
[aria-pressed='true'] in the default and Fluent themes.
An Action.Submit whose required inputs fail validation is not executed by
Adaptive Cards, but the capture-phase click handler still marked it as
selected. Mark the action from onExecuteAction instead.
@OEvgeny
Eugene (OEvgeny) force-pushed the OEvgeny/fix-card-action-pressed-state branch from 748f85c to b5870f4 Compare October 19, 2026 22:43
@OEvgeny

Copy link
Copy Markdown
Collaborator Author
image

@OEvgeny

Copy link
Copy Markdown
Collaborator Author

Follow-up: prototype immediate button selected state announcement

@OEvgeny
Eugene (OEvgeny) merged commit 2c28a27 into main Oct 20, 2026
62 checks passed
@OEvgeny
Eugene (OEvgeny) deleted the OEvgeny/fix-card-action-pressed-state branch October 20, 2026 23:30
Eugene (OEvgeny) pushed a commit that referenced this pull request Oct 21, 2026
…on main

#5900 removed the capture-phase click listener from the card root, so Chrome now leaves the role-less card out of the accessibility tree (role "none") instead of exposing it as "generic". Assert that neither card is a "figure" or a "form" instead.

The live region now reads the text of cards without "speak" (#5922), update the snapshot.
Eugene (OEvgeny) added a commit that referenced this pull request Oct 21, 2026
…nter on clickable elements (#5915)

* Do not set role="figure" on Adaptive Cards without a label

A card without "speak" has no name, and an unnamed "figure" or "form" is announced without its content.
Set the role only when the card has a label, fixes #5049.

* Show a pointer cursor on clickable Adaptive Card elements

Containers and images with "selectAction" get cursor: pointer; push buttons keep the default cursor, fixes #5130.

* Add PR number to changelog

* Show the live region copy in role mod snapshots

* Give the second card in hack.roleMod.html a distinct speak

Both cards had speak 'Hello, World!', so the live region snapshot read the same line twice.

* Move the changelog entry to .changelog/

* Fix unlabelled role mod test for card action and live region changes on main

#5900 removed the capture-phase click listener from the card root, so Chrome now leaves the role-less card out of the accessibility tree (role "none") instead of exposing it as "generic". Assert that neither card is a "figure" or a "form" instead.

The live region now reads the text of cards without "speak" (#5922), update the snapshot.

---------

Co-authored-by: Eugene Olonov <eugeneolonov@microsoft.com>
Eugene (OEvgeny) added a commit that referenced this pull request Oct 21, 2026
* Name Action.ShowCard as the exception in Adaptive Card hack comments

The comments named Action.ShowUrl, but the code exempts buttons with
aria-expanded, which is Action.ShowCard.

* Announce card action buttons as buttons, describe pressed actions as Selected

Card action buttons had aria-pressed, so screen readers announced them as
toggle buttons that never turn off (#5716, #5719, #5745, #5750). They are now
plain buttons; pressed actions are described as "Selected" via
aria-describedby, which keeps the choice announced (#3622), and is styled
via the adaptive-card-renderer__action--selected class instead of
[aria-pressed='true'] in the default and Fluent themes.

* Add PR number to changelog

* Select card actions only after Adaptive Cards performed them

An Action.Submit whose required inputs fail validation is not executed by
Adaptive Cards, but the capture-phase click handler still marked it as
selected. Mark the action from onExecuteAction instead.

* Shorten the changelog entry

* Snapshot every key step in ariaPushed.html

* Wait for the live region to clear before the accessibility check in selectedAction.validation.html

* Announce "Selected" when a card action is pressed

Screen readers do not re-read the description of the focused button after it changed,
so the "Selected" description added in #5900 was only heard on revisit.
Queue "Selected" in the live region once Adaptive Cards executed the action
(after validation passed), via the existing live region twin.

* Add PR number to changelog

* Test that pressing a selected card action again announces "Selected" again

* Move the changelog entry to .changelog/

* Move the changelog entry to .changelog/

---------

Co-authored-by: Eugene Olonov <eugeneolonov@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants