fix: use semantic button elements for in-page actions (a11y MAS 4.1.2)#3593
Draft
navya9singh wants to merge 1 commit into
Draft
fix: use semantic button elements for in-page actions (a11y MAS 4.1.2)#3593navya9singh wants to merge 1 commit into
navya9singh wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Interactive controls on the TypeScript homepage that trigger in-page JavaScript actions were implemented as
<a>elements. These get implicitrole="link", misleading screen reader users who expect button behavior.AzDO Bug: 2614223 — MAS 4.1.2 (Name, Role, Value)
Changes
EditorExamples.tsx
<a href="#" onClick={next}>→<button onClick={next} aria-label="Show code sample">AboveTheFold.tsx
<a href="#" onClick={...}>→<button onClick={...}>role="button"prop (progressive enhancement — onClick calls e.preventDefault())roleprop to interface and elementindex.scss
@mixin flat-button: addedborder: none; font-family: inherit; font-size: inherit;.transparent-button: addedbackground: none; font-family: inherit; font-size: inherit;