Skip to content

fix: use semantic button elements for in-page actions (a11y MAS 4.1.2)#3593

Draft
navya9singh wants to merge 1 commit into
v2from
fix/a11y-button-roles-2614223
Draft

fix: use semantic button elements for in-page actions (a11y MAS 4.1.2)#3593
navya9singh wants to merge 1 commit into
v2from
fix/a11y-button-roles-2614223

Conversation

@navya9singh

Copy link
Copy Markdown
Member

Summary

Interactive controls on the TypeScript homepage that trigger in-page JavaScript actions were implemented as <a> elements. These get implicit role="link", misleading screen reader users who expect button behavior.

AzDO Bug: 2614223 — MAS 4.1.2 (Name, Role, Value)

Changes

EditorExamples.tsx

  • "Show Sample Code" control: <a href="#" onClick={next}><button onClick={next} aria-label="Show code sample">

AboveTheFold.tsx

  • "Back" control: <a href="#" onClick={...}><button onClick={...}>
  • "Try TypeScript Now" FluidButton: added role="button" prop (progressive enhancement — onClick calls e.preventDefault())
  • FluidButton component: added optional role prop to interface and element

index.scss

  • @mixin flat-button: added border: none; font-family: inherit; font-size: inherit;
  • .transparent-button: added background: none; font-family: inherit; font-size: inherit;

Interactive controls that trigger in-page JavaScript actions (not navigation)
were implemented as <a> elements, which get implicit role='link'. Screen readers
announced them as links, misleading users expecting button behavior.

Fixes:
- EditorExamples.tsx: 'Show Sample Code' <a href='#' onClick> -> <button>
- AboveTheFold.tsx: 'Back' <a href='#' onClick> -> <button>
- AboveTheFold.tsx: 'Try TypeScript Now' FluidButton gets role='button' since
  its onClick calls e.preventDefault() (progressive enhancement pattern)
- index.scss: Add button resets (border:none, background:none, font-family/size
  inherit) to flat-button mixin and .transparent-button so <button> elements
  visually match the previous <a> styling

Addresses AzDO bug 2614223 (MAS 4.1.2 - Name, Role, Value)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@navya9singh navya9singh marked this pull request as draft June 28, 2026 07:18
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.

1 participant