Skip to content

[lexical-react] Bug Fix: no widget role or widget-only ARIA on a non-editable editor - #9270

Merged
etrepum merged 6 commits into
meta:mainfrom
potatowagon:potatowagon/readonly-aria-defaults
Oct 19, 2026
Merged

etrepum merged 6 commits into
meta:mainfrom
potatowagon:potatowagon/readonly-aria-defaults

Conversation

@potatowagon

Copy link
Copy Markdown
Contributor

Description

ContentEditableElement defaults role to textbox unconditionally, so a
non-editable editor renders an unnamed role="textbox". axe reports that as
aria-input-field-name (serious) for any read-only editor that has no
aria-label/aria-labelledby — and a read-only view rendering persisted
content usually has no reason to carry one.

It also forces aria-autocomplete="none" whenever the editor is not editable,
which is where the role came from. #2912 dropped the role in read mode; #4580
put it back because removing it left aria-autocomplete on a roleless div,
which axe reports as aria-allowed-attr. The attribute is the actual problem:
none is that attribute's own default, so it asserts nothing even where it is
legal, and it is widget-only ARIA on an element that is not a widget.

This change resolves the role first and derives the rest from it:

  • role defaults to textbox only while the editor is editable. A non-editable
    editor gets no role unless the caller passes one.
  • aria-autocomplete, aria-readonly, aria-multiline and aria-required are
    emitted only when a role is resolved, so neither violation can occur.
  • role={null} keeps meaning "no role at all", exactly as it did when role
    carried a default value.

A consumer whose read-only editor really is a form field is unaffected by
passing role="textbox" explicitly: it keeps aria-readonly="true" and every
attribute it has today. The three read-only snapshots in the nested-composer
tests are updated to the new markup; those editors carry aria-label, so they
stay named.

This is a behaviour change for read-only editors: a consumer asserting
getByRole('textbox') against one will need role="textbox" or a different
query.

Test plan

Added five cases to LexicalContentEditableElement.test.tsx covering the
editable default, the non-editable default, the explicit-role opt-out,
consumer-supplied widget ARIA, and a live editability toggle; plus an axe
assertion for a non-editable, unnamed editor.

Before

The new tests against unmodified source — the last failure is the reported
violation itself:

$ npx vitest run packages/lexical-react/src/__tests__/unit/LexicalContentEditableElement.test.tsx
   × renders no role and no widget ARIA when not editable
   × drops consumer widget-only ARIA when it resolves to no role
   × follows the editor when editability changes
   × has no accessibility violations when not editable and unnamed

AssertionError: expected 'textbox' to be null // Object.is equality

Error: expect(received).toHaveNoViolations(expected)
"ARIA input fields must have an accessible name (aria-input-field-name)"
https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=axeAPI

 Test Files  1 failed (1)
      Tests  4 failed | 18 passed (22)

After

$ npx vitest run packages/lexical-react/src/__tests__/unit/LexicalContentEditableElement.test.tsx
 Test Files  1 passed (1)
      Tests  22 passed (22)

$ pnpm run test-unit
 Test Files  360 passed (360)
      Tests  8866 passed | 1 skipped (8867)

$ pnpm run ci-check
Found 0 errors

The unit baseline on main at the same commit is 8860 passed / 360 files; the
delta is the six added cases. E2E and browser-mode suites were not run.

…editable editor

## Description

`ContentEditableElement` defaults `role` to `textbox` unconditionally, so a
non-editable editor renders an unnamed `role="textbox"`. axe reports that as
`aria-input-field-name` (serious) for any read-only editor that has no
`aria-label`/`aria-labelledby` — and a read-only view rendering persisted
content usually has no reason to carry one.

It also forces `aria-autocomplete="none"` whenever the editor is not editable,
which is where the role came from. meta#2912 dropped the role in read mode; meta#4580
put it back because removing it left `aria-autocomplete` on a roleless div,
which axe reports as `aria-allowed-attr`. The attribute is the actual problem:
`none` is that attribute's own default, so it asserts nothing even where it is
legal, and it is widget-only ARIA on an element that is not a widget.

This change resolves the role first and derives the rest from it:

- `role` defaults to `textbox` only while the editor is editable. A non-editable
  editor gets no role unless the caller passes one.
- `aria-autocomplete`, `aria-readonly`, `aria-multiline` and `aria-required` are
  emitted only when a role is resolved, so neither violation can occur.
- `role={null}` keeps meaning "no role at all", exactly as it did when `role`
  carried a default value.

A consumer whose read-only editor really is a form field is unaffected by
passing `role="textbox"` explicitly: it keeps `aria-readonly="true"` and every
attribute it has today. The three read-only snapshots in the nested-composer
tests are updated to the new markup; those editors carry `aria-label`, so they
stay named.

This is a behaviour change for read-only editors: a consumer asserting
`getByRole('textbox')` against one will need `role="textbox"` or a different
query.

## Test plan

Added five cases to `LexicalContentEditableElement.test.tsx` covering the
editable default, the non-editable default, the explicit-role opt-out,
consumer-supplied widget ARIA, and a live editability toggle; plus an axe
assertion for a non-editable, unnamed editor.

### Before

The new tests against unmodified source — the last failure is the reported
violation itself:

```
$ npx vitest run packages/lexical-react/src/__tests__/unit/LexicalContentEditableElement.test.tsx
   × renders no role and no widget ARIA when not editable
   × drops consumer widget-only ARIA when it resolves to no role
   × follows the editor when editability changes
   × has no accessibility violations when not editable and unnamed

AssertionError: expected 'textbox' to be null // Object.is equality

Error: expect(received).toHaveNoViolations(expected)
"ARIA input fields must have an accessible name (aria-input-field-name)"
https://dequeuniversity.com/rules/axe/4.12/aria-input-field-name?application=axeAPI

 Test Files  1 failed (1)
      Tests  4 failed | 18 passed (22)
```

### After

```
$ npx vitest run packages/lexical-react/src/__tests__/unit/LexicalContentEditableElement.test.tsx
 Test Files  1 passed (1)
      Tests  22 passed (22)

$ pnpm run test-unit
 Test Files  360 passed (360)
      Tests  8866 passed | 1 skipped (8867)

$ pnpm run ci-check
Found 0 errors
```

The unit baseline on `main` at the same commit is 8860 passed / 360 files; the
delta is the six added cases. E2E and browser-mode suites were not run.
@vercel

vercel Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
lexical Ready Ready Preview Oct 19, 2026 1:48am UTC
lexical-playground Ready Ready Preview Oct 19, 2026 1:48am UTC

Request Review

@potatowagon

Copy link
Copy Markdown
Contributor Author

Downstream consumer-side fix for the same defect, with the rendered-DOM evidence: meta/astryx#6741. That one clears the three attributes from the consumer side, which is needed regardless of this PR while lexical is a peer dependency pinned to a published range — this PR is what makes those overrides unnecessary.

potatowagon added a commit to potatowagon/astryx that referenced this pull request Sep 29, 2026
## User impact

Anyone using a screen reader on content rendered by `RichTextView` — a stored
comment, a saved note, any persisted rich text.

Lexical's `ContentEditable` applies `role="textbox"` even when the editor is not
editable, and `RichTextView` passes it nothing to name itself with. Two effects:

- axe reports `aria-input-field-name` (serious) on every story that mounts a
  view. Both instances sit in `.github/a11y-baseline.json`, so CI has been green
  on a live defect.
- `textbox` is a widget role, so assistive technology presents the content as
  the field's *value* — one flat string. The heading, list and link structure
  this component exists to render is suppressed, which is the larger harm and
  the one a name would not have fixed.

## Problem and solution fit

Why does the defect occur? `RichTextView` renders Lexical's `ContentEditable`
with no props, and Lexical defaults `role` to `textbox` regardless of
editability.

Why does that harm the task? The task is reading published content. A widget
role misdescribes it and flattens its structure; unnamed, it is also announced
with no indication of what it is.

Why does that matter? This is the read path for stored rich text, so the
component's entire output is affected, and the baseline entry means nothing
surfaces it.

The fix says what the element is rather than patching the symptom. A view is
content, so it takes no widget role — which removes the requirement for a name
instead of satisfying it, and restores the structural roles.

## Expected behavior and authority

The read-only *form field* case is already served: `<RichTextEditor isDisabled />`
is a labelled field by construction. `RichTextView`'s own contract is its
docstring — "a read-only renderer for serialized Lexical content… without any
editing affordances" — i.e. content.

Upstream history agrees this is a defect rather than a design choice.
meta/lexical#2912 dropped the role in read mode; meta/lexical#4580 put
it back only because removing it left an orphaned `aria-autocomplete="none"`
that axe reports as `aria-allowed-attr`. The upstream fix is
meta/lexical#9270; this change is the consumer-side fix, which is needed
regardless because `lexical` is a peer dependency pinned at `^0.46.0`.

## Smallest restoration

Three attributes cleared on the view's `ContentEditable`, with the reasoning
recorded next to them:

- `role` — `null`, not `undefined`, because Lexical applies its `textbox`
  default to `undefined`.
- `aria-autocomplete`, `aria-readonly` — widget-only ARIA, invalid without a
  widget role. Clearing the role alone would trade `aria-input-field-name` for
  `aria-allowed-attr`.

Also in scope because they are the same defect:

- `README.md` used `<RichTextView label="Notes" …>`; that prop has never existed
  and does not type-check. Removed.
- The 12 `RichTextEditor::*::aria-input-field-name` baseline entries are
  deleted: the audit reports 9 of them already resolved before this change, and
  this change resolves the rest.
- The `SYNC:` header in `RichTextView.tsx` pointed at
  `RichTextView.test.tsx`, which does not exist; its tests live in
  `RichTextEditor.test.tsx`. Corrected per the repository's update protocol.

`RichTextEditor` is unaffected — it already names its `ContentEditable`.

## Evidence

**Reproduction before the change** — the new test against unmodified source
prints the three attributes:

```
$ npx vitest run packages/richtext -t "renders content rather than a form field"
 FAIL  packages/richtext/src/RichTextEditor.test.tsx > RichTextView > renders content rather than a form field
expected document not to contain element, found <div
  aria-autocomplete="none"
  aria-readonly="true"
  role="textbox"

      Tests  1 failed | 87 skipped (88)
```

axe over the story set, on `main`:

```
$ node .github/scripts/accessibility-audit.js --baseline .github/a11y-baseline.json \
    --fail-on-new --components RichTextEditor
✓ Audited: RichTextEditor / Controlled Persistence - 1 issues
Audit complete: 1 total violations found
0 new, 1 baselined, 9 resolved, 156 baselined for stories outside this run
  ✓ RichTextEditor::Custom Transformers::aria-input-field-name
  ✓ RichTextEditor::Default::aria-input-field-name
  ... (9 baseline entries reported already resolved)
```

**Result after the change**:

```
$ node .github/scripts/accessibility-audit.js --baseline .github/a11y-baseline.json \
    --fail-on-new --components RichTextEditor
✓ Audited: RichTextEditor / Default - 0 issues
... all 15 stories ...
Audit complete: 0 total violations found
0 new, 0 baselined, 0 resolved, 154 baselined for stories outside this run
No new accessibility violations. Gate passed.

$ node .github/scripts/accessibility-audit.js ... --components RichTextView
Owner route: richtext/RichTextView -> lab-richtexteditor--markdown-serializers
✓ Audited: RichTextEditor / Markdown Serializers - 1 issues
0 new, 1 baselined, 0 resolved
```

The one remaining violation on that story is `label` (critical) — the bare
`<textarea>` in the story's own chrome, not the component. Its baseline entry is
kept deliberately; it is a separate defect.

**Representative unchanged path**: `RichTextEditor`'s own stories are in the
same run above and report 0 issues throughout; the 88 richtext unit tests
include its label wiring, status variants and toolbar behaviour.

**Regression test**: three cases in `RichTextEditor.test.tsx` — the view has no
`textbox` role and none of the widget ARIA, and list structure is reachable by
role. The pre-existing "renders serialized content read-only" test asserted
`getByRole('textbox')`, which encoded the defect; it now queries
`[data-lexical-editor]` and keeps asserting `contenteditable="false"`.

## Scope

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

## Testing

```
$ npx vitest run packages/richtext
 Test Files  1 passed (1)
      Tests  88 passed (88)

$ pnpm run lint
✖ 82 problems (0 errors, 82 warnings)     # unchanged; pre-existing no-raw-color

$ pnpm run check:sync
✅ All SYNC comments are clean.
```

Real-browser states: the axe runs above drive the built Storybook in Chromium
via Playwright, which is where the role and ARIA are actually observed.

Full `pnpm run test` was run on this branch and on `main` at the same commit.
The suite is flaky at this commit under parallelism — `main` itself reports 76
failures, this branch 64 — and the differing files are CLI template/perf tests
unrelated to this change. All three that differed pass in isolation on this
branch, and one of them fails in isolation on clean `main`.

@etrepum etrepum left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this can leave the ContentEditable in a different state that also isn't compliant, here's the two that codex picked up:

[P2] Standard ARIA props bypass the new filtering.
LexicalContentEditableElement.tsx:140–154
Only camelCase props are filtered; the preferred aria-* props survive through {...rest}. For example, aria-multiline={true} remains after editor.setEditable(false) removes the role, producing aria-allowed-attr. The same happens with aria-required, aria-autocomplete, aria-readonly, and aria-placeholder—which ContentEditable requires when supplying a placeholder. Normalize and filter the standard props too, including placeholder ARIA, and test editability toggles through that API.

[P2] Removing the role leaves prohibited naming attributes.
LexicalContentEditableElement.tsx:115–116
An empty editor with just aria-label="Notes" passes axe before this change, but switching it to read-only now produces aria-prohibited-attr: the label remains on a div without a nameable role. The existing label props need handling alongside role resolution. Add coverage for labelled read-only editors; the new unnamed-editor test misses this. The PR’s claim that the updated nested-editor snapshots “stay named” also needs correction.

…itor

## Description

Review follow-up to the previous commit, which dropped `role="textbox"` from
every non-editable editor. That was too broad in one direction and too narrow
in the other.

**Too broad.** A read-only editor carrying `aria-label` was axe-clean before
that commit and reported `aria-prohibited-attr` after it: the name stayed on an
element that no longer had a role to be named. The rule is now that the element
carries a widget role **if and only if it can be named** — a non-editable
editor with `aria-label`/`aria-labelledby` keeps `textbox` and renders exactly
the markup it did before this PR, and only an unnamed one takes no role. Both
violations follow from that single invariant: an unnamed widget role is
`aria-input-field-name`, a name on a roleless element is
`aria-prohibited-attr`.

**Too narrow.** Only the camelCase `aria*` aliases were gated. The hyphenated
`aria-*` props — the documented preferred spelling — reached the DOM through
the prop spread, which runs last, so `aria-multiline`, `aria-required`,
`aria-readonly` and `aria-placeholder` all survived the role being removed.
They are now normalized against their camelCase aliases before the gate, with
the hyphenated spelling winning, and `aria-placeholder` is gated too.

Because a named read-only editor keeps its role, the three nested-composer
snapshots the previous commit updated are reverted: those editors carry
`aria-label`, so their markup does not change at all. This also corrects that
commit's claim that the snapshots "stay named" — under this revision they are
simply untouched.

## Test plan

### Before

The new cases against the previous commit:

```
$ npx vitest run packages/lexical-react/src/__tests__/unit/LexicalContentEditableElement.test.tsx
   × keeps the role and its widget ARIA when not editable but named
   × keeps the role when named via aria-labelledby
   × keeps the role when named via the hyphenated aria-label
   × drops hyphenated widget-only ARIA too, not just the camelCase aliases
   × keeps aria-placeholder when a role is resolved
   × keeps a named editor stable across editability changes
   × has no accessibility violations when not editable and named

AssertionError: expected null to be 'textbox' // Object.is equality
AssertionError: expected 'true' to be null // Object.is equality
"Elements must only use permitted ARIA attributes (aria-prohibited-attr)"
https://dequeuniversity.com/rules/axe/4.12/aria-prohibited-attr?application=axeAPI

 Test Files  1 failed (1)
      Tests  7 failed | 23 passed (30)
```

### After

```
$ npx vitest run packages/lexical-react/src/__tests__/unit/LexicalContentEditableElement.test.tsx
 Test Files  1 passed (1)
      Tests  30 passed (30)

$ pnpm run test-unit
 Test Files  360 passed (360)
      Tests  8874 passed | 1 skipped (8875)

$ pnpm run ci-check
Found 0 errors
```

E2E and browser-mode suites were not run.
@potatowagon

Copy link
Copy Markdown
Contributor Author

Both confirmed and fixed in 7dfd900 — stacked rather than squashed so the delta is readable on its own. Thanks, the second one was a regression I introduced.

[P2] Removing the role leaves prohibited naming attributes. Correct, and it reframed the fix. Reproduced: a read-only editor with aria-label="Notes" was axe-clean before my change and reported aria-prohibited-attr after it.

The rule is now that the element carries a widget role if and only if it can be named:

  • editable → textbox, as before;
  • non-editable with aria-label/aria-labelledby → keeps textbox and every attribute it has today;
  • non-editable without a name → no role, and no widget-only ARIA.

Both violations fall out of that one invariant — an unnamed widget role is aria-input-field-name, a name on a roleless element is aria-prohibited-attr — and it narrows the behaviour change to the unnamed read-only editor, which is the only case that was already broken. A labelled read-only editor now renders byte-identical markup to main.

That also disposes of your last point: the nested-composer snapshots are reverted in this revision. Those editors carry aria-label, so they keep their role and their markup does not change at all. The claim was wrong and the diff it described is gone.

[P2] Standard ARIA props bypass the new filtering. Also correct — rest spreads last, so gating only the camelCase aliases let every hyphenated one through. Verified: aria-multiline={true} survived the role being removed.

The hyphenated props are now destructured out of rest and normalized against their camelCase aliases before the gate, with the hyphenated spelling winning per the documented preference. aria-placeholder is gated with them, so a read-only unnamed editor given a placeholder no longer claims one; with a name it keeps it.

Coverage went 6 → 17 cases in that file. The seven that fail against the previous commit are exactly the two problems above, including the aria-prohibited-attr axe assertion you predicted:

× keeps the role and its widget ARIA when not editable but named
× keeps the role when named via aria-labelledby
× keeps the role when named via the hyphenated aria-label
× drops hyphenated widget-only ARIA too, not just the camelCase aliases
× keeps aria-placeholder when a role is resolved
× keeps a named editor stable across editability changes
× has no accessibility violations when not editable and named
      Tests  7 failed | 23 passed (30)

pnpm run test-unit 8874 passed / 360 files, ci-check clean. E2E and browser-mode not run.

One judgement call worth flagging, since it is an implicit behaviour: deriving the role from the presence of a name means a consumer who removes aria-label from a read-only editor also silently loses the role. I took that over the alternatives — dropping the consumer's naming attributes (destroys intent) or substituting a nameable non-widget role like group (changes semantics for everyone) — because it is the only one that leaves every currently-valid configuration untouched. Happy to switch if you would rather it were explicit.

@etrepum etrepum left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codex and claude picked up a few additional edge cases

codex:

[P2] Explicit read-only comboboxes lose required aria-expanded.
Lines 166–169 now filter the standard prop through isEditable. With role="combobox", aria-label="Notes", aria-expanded={false} and valid aria-controls, making the editor read-only removes aria-expanded while retaining the role. This produces aria-required-attr, reproduced locally. Comboboxes require an expanded state even when collapsed. Preserve the explicit attribute when retaining that role. w3.org

[P2] The name check misses editors named through title.
Line 143 considers only the two ARIA naming props. A read-only was an axe-clean, named textbox on the base commit. This PR removes its role and aria-readonly, treating it as unnamed content. title can supply the accessible name; include it if the intended compatibility rule is to preserve already-named read-only fields.

claude:

  • On a combobox, aria-expanded="false" now renders as "true", because the string "false" is truthy and the code coerces it with !!.
  • aria-label="" counts as a name, so the read-only editor keeps textbox and still fails aria-input-field-name.

… combobox expanded

## Description

Second review follow-up. Three of these are regressions from the previous
commit's own fix: pulling the hyphenated `aria-*` props out of `rest` so they
could be gated also subjected them to gating they had previously bypassed,
because `rest` is spread last and reached the DOM unfiltered.

- **`aria-expanded` was dropped from a read-only combobox.** It was gated on
  `isEditable`, so making a combobox read-only removed an attribute the role
  requires, which axe reports as `aria-required-attr`. It is now emitted
  whenever the resolved role is `combobox`, editable or not.
- **The string `"false"` on `aria-expanded` rendered as `"true"`.** The value
  went through `!!`, and `"false"` is truthy. React's own type for the
  attribute allows that string and ARIA reads it as false, so the authored
  value is now preserved rather than coerced. The camelCase `ariaExpanded`
  alias is normalized the same way; it had the same defect, invisibly, since
  it was always gated.
- **`title` did not count as an accessible name.** A read-only
  `<ContentEditableElement title="Notes" />` was an axe-clean named textbox
  before this PR, and the previous commit treated it as unnamed content.
  `title` supplies the accessible name when no ARIA label does, so it now
  participates in the name check.

The fourth predates the PR:

- **An empty `aria-label` counted as a name.** `aria-label=""` names nothing,
  so a read-only editor carrying one kept `role="textbox"` and still failed
  `aria-input-field-name` — on `main` as well as here. A name must now be a
  non-empty string after trimming, in any of the three sources, so that case
  resolves to no role and is clean.

## Test plan

Five cases added, covering each finding plus the `"true"` string for symmetry.

### Before

The new cases against the previous commit:

```
$ npx vitest run --project unit packages/lexical-react/src/__tests__/unit/LexicalContentEditableElement.test.tsx
   × does not count an empty aria-label as a name
   × counts title as an accessible name
   × keeps aria-expanded on a read-only combobox
   × reads the string "false" on aria-expanded as false

 Test Files  1 failed (1)
      Tests  4 failed | 31 passed (35)
```

Rendered output on that commit, and on `main` for comparison:

```
                                  main          prev commit    this commit
read-only combobox aria-expanded  "false"       (absent) ✗     "false"
aria-expanded="false" renders     "false"       "true"   ✗     "false"
read-only title="Notes" role      "textbox"     (absent) ✗     "textbox"
read-only aria-label="" axe       aria-input-   aria-input- ✗  (clean)
                                  field-name ✗  field-name
```

### After

```
$ npx vitest run --project unit packages/lexical-react/src/__tests__/unit/LexicalContentEditableElement.test.tsx
 Test Files  1 passed (1)
      Tests  35 passed (35)

$ pnpm run test-unit
 Test Files  375 passed (375)
      Tests  9122 passed | 1 skipped (9123)

$ pnpm run ci-check
Found 0 errors
```

E2E and browser-mode suites were not run.
@potatowagon

Copy link
Copy Markdown
Contributor Author

All four confirmed and fixed in 4690587, stacked again so the delta reads on its own.

Three of the four are regressions from my previous commit, and they share one cause worth naming: pulling the hyphenated aria-* props out of rest so they could be gated also subjected them to gating they had previously bypassed. rest spreads last, so on main an aria-expanded={false} went straight to the DOM and never touched the isEditable && combobox ternary or the !!. Fixing the leak exposed two latent bugs in code that had been unreachable for those props.

I verified each against main rather than reasoning about it:

main prev commit now
read-only combobox aria-expanded "false" absent ❌ "false"
aria-expanded="false" renders "false" "true" ❌ "false"
read-only title="Notes" role textbox absent ❌ textbox
read-only aria-label="" aria-input-field-name ❌ aria-input-field-name ❌ clean

[P2] combobox loses aria-expanded — correct, and aria-required-attr reproduces exactly as described. It is now emitted whenever the resolved role is combobox, editable or not, since the role requires it either way.

[P2] title misses the name check — correct, and this is the sharper of the two: a title-named read-only editor was axe-clean on main and my commit demoted it to content. title now participates in the name check, so the compatibility rule is what it claims to be — already-named read-only fields keep their role, whichever of the three sources names them.

claude's "false" coercion — correct. React's own type for the attribute permits the string and ARIA reads it as false. The authored value is preserved rather than coerced, and the camelCase ariaExpanded alias is normalized the same way: it had the identical defect, invisibly, because it was always gated behind isEditable.

claude's empty aria-label — correct, and the only one that predates the PR: aria-label="" kept role="textbox" and still failed aria-input-field-name on main too. A name is now required to be non-empty after trimming, in any of the three sources, so that case resolves to no role and comes out clean — slightly better than main.

Coverage is 17 → 22 cases in that file; the four that fail against the previous commit are exactly the findings above. pnpm run test-unit 9122 passed / 375 files, ci-check clean. E2E and browser-mode not run.

Thanks for putting two more models on it — the title case in particular is one I would not have found, since it only shows up when you ask what else can name an element.

…ides

## Description

Follow up on meta#9270 at 4690587.

Normalizing standard ARIA props through the legacy aliases discards valid
authored attributes and resurrects aliases when a standard prop explicitly
supplies undefined. A tree item loses aria-expanded, a read-only combobox
loses aria-activedescendant, and a cleared aria-label falls back to the
legacy label.

Merge the legacy defaults with standard props using the original spread
precedence, resolve the default role from the resulting naming attributes,
and filter widget attributes only when the resolved role is absent. Retain
the named read-only editor behavior and combobox expanded defaults.

Add five regression cases covering tree-item state, combobox editability
toggles, cleared labels with and without a title, and undefined widget
overrides. Extend the roleless-content case to cover active descendants,
autocomplete, and expanded state. Clarify the prop documentation.

## Test plan

### Before

Review probes run against the parent revision before the execution
environment became unavailable:

```
$ node node_modules/vitest/vitest.mjs run --project unit packages/lexical-react/src/__tests__/unit/Review9270.test.tsx
 Test Files  1 failed (1)
      Tests  3 failed (3)
```

The same three probes passed against the PR base.

### After

Executed the prop-resolution block extracted from the revised source in an
isolated JavaScript runtime, removing only its TypeScript variable annotation.
The checks cover the reported regressions, explicit undefined precedence,
roleless filtering, named read-only defaults, and boolean/string combobox
expanded values:

```
{"propResolutionCasesPassed":29}
```

The execution environment is offline, so the committed Vitest/axe cases,
TypeScript, formatting/lint checks, browser tests, and E2E tests have not been
run against this follow-up. The JavaScript checks do not validate React
rendering or TypeScript types.
@etrepum
etrepum added this pull request to the merge queue Oct 19, 2026
Merged via the queue into meta:main with commit 3ac4eb8 Oct 19, 2026
48 checks passed
@zurfyx zurfyx mentioned this pull request Oct 27, 2026
zurfyx added a commit that referenced this pull request Oct 27, 2026
…ed since #9353

## Description

The changesets in this PR covered main up to #9353. Since then, 27 PRs
that change a published package's shipped code have merged without one,
so the v0.53.0 release would list them only under "All changes". This adds
a changeset for each, with a `PR:` line and the author's handle:

- `[breaking]`: #9478 (`@lexical/mdast` table alignment moves out of the
  `mdastTableAlign` NodeState) and #9329 (`reconcileObservedMutation`,
  `@internal`), both with `Migration:` and `Detect:`.
- `[feature]`: #9452, #9421, #9380 (experimental), #9360, #9365.
- `[perf]`: #9349.
- `[fix]`: the remaining 19. #9396, #9392, #9270 and #9360 carry `Verify:`
  because they change observable output.

Website, playground, devtools, CI and internal lint changes need none.

## Test plan

### Before

```
$ git log --format=%s fd661f0..origin/main   # merged since this PR's base
(27 PRs touching published packages' src/flow, none with a changeset)
```

### After

```
$ pnpm run check-changesets
Changeset check passed: 54 pending changeset(s) valid.

$ pnpm run changelog
## v0.53.0 (2026-10-27)
### Breaking changes
- **lexical, @lexical/clipboard, @lexical/selection, @lexical/table**: Let mouse drags select across inline decorators; ... (#9329)
- **@lexical/mdast**: `MdastTableExtension` reads and writes GFM tables, ... (#9478)
- **@lexical/code-core, ...**: Remove the extensions deprecated in v0.52.0 and earlier (#9316)
### Behavior changes
...
```
AlessioGr added a commit to payloadcms/payload that referenced this pull request Oct 28, 2026
_Written with AI_

Upgrades  lexical from `0.52.0` to `0.53.0`.

## Breaking changes

Rich-text data keeps its existing format. No database migration is
needed. Payload's built-in features have been updated, but your own
TypeScript code or custom features may need changes:

- **Node type arguments:** `getParent<T>()`, `getParentOrThrow<T>()`,
`getChildren<T>()`, `getFirstChild<T>()`, `getNextSibling<T>()`,
`$getNodeByKey<T>()` and the rest of that family no longer accept a type
argument. Remove `<T>` and narrow the result with a node guard such as
`$isListItemNode`. Runtime behavior is unchanged.
- **Removed extensions:** `LinkImportExtension`, `ListImportExtension`,
`RichTextImportExtension` and `HorizontalRuleImportExtension`
(deprecated in 0.52) are no longer exported from
`@payloadcms/richtext-lexical/lexical/link`, `/list`, `/rich-text` and
`/html`. Use `LinkExtension`, `ListExtension` and `RichTextExtension`;
for horizontal rules, use `HorizontalRuleExtension` from
`@lexical/extension`.
- **Markdown export:** `convertLexicalToMarkdown` escapes literal
brackets and HTML-like text, for example `[note]` becomes
`&#91;note&#93;`, so it is not parsed back as a link or HTML.
`convertMarkdownToLexical` restores the original text.

## Breaking changes and Payload migrations

Reviewed [0.53.0](https://github.com/meta/lexical/releases/tag/v0.53.0)
and the `CHANGELOG.md` now shipped in the `lexical` package, including
its behavior changes. **Yes** means Payload code needed adaptation;
**No** means no Payload migration was required.

| Breaking change | Required migration in Payload | Changes made |
|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| ----------------------------- |
---------------------------------------------------------------------------------------------------------------------------------------------------
|
| [Unchecked node type arguments are
removed](meta/lexical#9479) from traversal
and key lookup methods. | Yes | `TableCellResizerPlugin` called
`tableRow.getChildren<TableCellNode>()`. It now uses
`.filter($isTableCellNode)`, matching the upstream playground. |
| [Extensions deprecated in 0.52 are
removed](meta/lexical#9316). | No | Payload
does not use them. They disappear from the `export *` proxies listed
above. |
| [`ElementNode.reconcileObservedMutation` restores the committed
children's DOM](meta/lexical#9329)
(`@internal`). | No | No Payload call sites. |
| [`@lexical/mdast` stores table column alignment as cell paragraph
format](meta/lexical#9478). | No | Payload
does not use `@lexical/mdast`. |
| Behavior: [Markdown export escapes literal
text](meta/lexical#9481). | No | Documented
in the migration guide. MDX round-trip int tests pass unchanged. |
| Behavior: [a read-only `ContentEditable` without an accessible name no
longer renders
`role="textbox"`](meta/lexical#9270). | No |
Payload passes the field label as `aria-label`, so labeled read-only
editors keep the role. |
| Behavior: [`ClickableLinkPlugin` opens new tabs without
`window.opener`](meta/lexical#9303), and
[nested editors handle their own link
clicks](meta/lexical#9360). | No | The link
feature uses `ClickableLinkPlugin` and gets the reverse-tabnabbing fix
automatically. |

Package entry points of every proxied package were compared against
0.52.0. The only addition is the experimental
`@lexical/html/BlockIdHTMLExtension` subpath. Payload only re-exports
the `@lexical/html` root, so no proxy exports need adding or removing.

## Previous Lexical upgrades

- [#18397](#18397) — 0.50.0 →
0.52.0
- [#18149](#18149) — 0.48.0 →
0.50.0
- [#17554](#17554) — 0.45.0 →
0.48.0

This branch was successfully deployed

2 active deployments
Preview – lexical — 063f953f Deployed Oct 19, 2026 by vercel[bot]
Preview – lexical-playground — 063f953f Deployed Oct 19, 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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants