Skip to content

Describe Adaptive Card input errors instead of naming the input with them - #6021

Merged
Eugene (OEvgeny) merged 3 commits into
mainfrom
OEvgeny/fix-ac-input-error-describedby
Nov 6, 2026
Merged

Eugene (OEvgeny) merged 3 commits into
mainfrom
OEvgeny/fix-ac-input-error-describedby

Conversation

@OEvgeny

@OEvgeny Eugene (OEvgeny) commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #5613

Changelog Entry

Fixed

  • Fixed #5613, Adaptive Card input errors read as part of the input's name, in PR #6021, by @OEvgeny

Description

Adaptive Cards puts the validation error's ID in the input's aria-labelledby, so screen readers read "Role Please select the role Project Manager" as its name; it never sets aria-invalid and keeps the ID after the error is gone. A new card mod moves the error to aria-describedby, sets aria-invalid="true" while it is shown, and drops IDs that point to nothing. Not yet checked with Narrator or NVDA.

Design

  • The long-term fix is upstream, in Input.getAllLabelIds() (still in adaptivecards 3.0.6); the mod does nothing once the error is no longer in the name.
  • Not aria-errormessage: screen reader support is still uneven; aria-describedby is read everywhere.
  • Undo restores an attribute only if Adaptive Cards has not rewritten it (validation rewrites aria-labelledby in place).
  • Runs like the other mods: after render and on card DOM changes, one query per input.

Specific Changes

  • useInputErrorShouldBeDescriptionModEffect.ts: new mod, used by AdaptiveCardRenderer.tsx

  • setOrRemoveAttributeIfFalseWithUndoIfUnchanged.ts: compare-and-restore undo

  • hack.inputErrorShouldBeDescriptionMod.*.html, text, toggle, multi-select: snapshot 1 error (label is the name, error the description, invalid), 2 cleared (no dangling ID); text submits 2×

  • ….choiceSet.filtered.html: snapshot 1, text box described by the error, invalid

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

Eugene Olonov added 2 commits November 5, 2026 12:21
…them

When validation fails, Adaptive Cards adds the ID of the error message to
"aria-labelledby" of the input, so screen readers read the error as part of
the input's name, e.g. "Role Please select the role Project Manager". It
never sets "aria-invalid", and keeps the ID after the error is removed.

Add an Adaptive Card mod that moves the ID of the error message to
"aria-describedby", sets `aria-invalid="true"` while the error is shown, and
removes IDs that point to nothing. It does nothing when Adaptive Cards does
not name the input with the error.

Adaptive Cards rewrites "aria-labelledby" on every validation without
re-rendering, so the mod uses a new sibling of
`setOrRemoveAttributeIfFalseWithUndo`,
`setOrRemoveAttributeIfFalseWithUndoIfUnchanged`, whose undo restores an
attribute only if it still has the value it set.

Fixes #5613.
@OEvgeny
Eugene (OEvgeny) marked this pull request as ready for review November 6, 2026 06:49
Copilot AI balanced review requested due to automatic review settings November 6, 2026 06:49

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 insufficient remaining quota. Try requesting a review at a lower effort level.

@OEvgeny
Eugene (OEvgeny) merged commit 8e46c97 into main Nov 6, 2026
46 checks passed
@OEvgeny
Eugene (OEvgeny) deleted the OEvgeny/fix-ac-input-error-describedby branch November 6, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linked:Bug11059109 Screen reader is announcing extra information along with error message

3 participants