Skip to content

fix(lab): a busy comment editor's Cancel link stays in the tab order - #7909

Merged
cixzhang merged 1 commit into
mainfrom
fix/lab-action-link-focusable-disabled
Oct 22, 2026
Merged

cixzhang merged 1 commit into
mainfrom
fix/lab-action-link-focusable-disabled

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Fixes part of #7819 (the comment editor's Cancel link).

User impact

While an edited comment is saving, a keyboard or screen-reader user loses the editor's Cancel link: it is pulled out of the tab order with tabIndex=-1, so Shift+Tab skips it and they can't find it or hear that it is disabled. After this change Cancel stays in the tab order, reports aria-disabled="true", refuses activation, and shows the system's disabled paint.

Problem and solution fit

  • Why does it happen? MetadataActionLink, the lab helper behind the editor's Cancel and a comment's Edited link, sets aria-disabled and tabIndex={-1} on its Link instead of using Link's own disabled state.
  • Why does it hurt? A disabled control that is still on screen becomes unreachable from the keyboard. It also looks enabled while it refuses to work.
  • Why does it matter? The system contract says a disabled control keeps its enabled focus order. Core Link already implements that for isDisabled.

Expected behavior and authority

spec:AST-085 (current):

  • FR1: a disabled control exposes aria-disabled="true" and keeps its enabled focus order.
  • FR2: a disabled control does not activate or invoke a callback.
  • FR6: disabled paint applies to the disabled state.

Smallest restoration

MetadataActionLink passes isDisabled to Link instead of setting aria-disabled and tabIndex itself. Link then:

  • keeps the control focusable with aria-disabled;
  • blocks Enter, Space and pointer activation;
  • applies its disabled paint (half opacity, no pointer events).

The existing onClick guard stays as a second line of defense. There is no new prop, and nothing changes while the link is enabled.

A new Lab/Comments story, "Saving an edit", keeps an edit's save pending so the busy editor can be inspected.

Evidence

  • Before: Cancel carries tabindex="-1" while busy, and Shift+Tab from the editor's text box never reaches it. The new test fails on main.
  • After: Cancel is the first Shift+Tab stop from the text box, and Enter leaves the editor open.
  • Unchanged path: while not busy, Cancel and the Edited link render and behave as before.

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

The editor's Post button and the panel's Clear all are core Buttons, so they follow the core Button issue rather than this lab change. @astryxdesign/lab is private, so there is no Changeset.

Testing

  • pnpm exec vitest run packages/lab/src/Comments: 68 passed. The new test fails on main, where Cancel has tabindex="-1".

  • Commit hook repository checks pass.

  • Real browser: headless Chrome 156 over CDP, with accessibility nodes from Accessibility.getPartialAXTree.

    • Builds: both arms are local Storybook builds of the new story. Before uses main's lab source; after uses this head.
    • Steps: open Avery Kim's comment actions, choose Edit, then press Send, which leaves the save pending.
    Arm Cancel tabindex aria-disabled AX disabled / focusable Shift+Tab from the text box Enter on Cancel Opacity / pointer events
    before -1 true true / true never reaches Cancel (unreachable) 1 / auto
    after (none) true true / true first stop editor stays open 0.5 / none

MetadataActionLink passes isDisabled to Link, which keeps a disabled link
focusable with aria-disabled and blocks activation (spec:AST-085 FR1, FR2),
instead of dropping it from the tab order with tabIndex=-1. Link's disabled
paint now applies too (FR6).
@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 22, 2026 11:25am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 22, 2026
@astracat-bot

astracat-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 22, 2026, 11:50 AM UTC

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/lab N/A 4.3KB 1.8KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

46 of 490 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
RichTextEditor Markdown parity: side by side probe dark 94,866
RichTextEditor Markdown parity: side by side probe light 89,762
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
Markdown Default neutral dark 7,573
Markdown Default neutral light 7,566

and 26 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot 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.

This looks ready to approve: routing the comment editor's Cancel link through Link's own isDisabled keeps it in the Tab order while an edit saves, exposes it as disabled, refuses activation and gives it the disabled paint, as spec:AST-085 FR1, FR2, FR5 and FR6 require. The new test fails on main and passes on this branch, and in the browser Shift+Tab from the edit box now reaches Cancel while Enter leaves the edit open. Nothing further is needed from you.

[Automated review]

@cixzhang
cixzhang merged commit 02f5fe4 into main Oct 22, 2026
67 checks passed
@cixzhang
cixzhang deleted the fix/lab-action-link-focusable-disabled branch October 22, 2026 11:52

This branch was successfully deployed

1 active deployment
Preview — b400f460 Deployed Oct 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant