Skip to content

Bug: role="textbox" should be preserved in read-only mode #7500

@thorn0

Description

@thorn0

When a Lexical editor is read-only, its root <div contenteditable> drops role="textbox".
Playwright’s locator.fill() (and any API depending on the same autowait logic) rejects the element and throws:

Element is not an <input>, <textarea>, <select> or [contenteditable]
and does not have a role allowing [aria-readonly]

Every editor instance starts in this transient read-only state for a split second during initialisation, so tests frequently stumble over the error even though the editor soon becomes editable.

Lexical version: 0.30.0

Steps To Reproduce

  1. clone https://github.com/thorn0/lexical-repro
  2. npm install
  3. npm run test

The current behavior

  • role="textbox" is removed while aria-readonly="true" is present.
  • Playwright (and assistive tech relying on ARIA roles) no longer recognises the element as a textbox, so autowait in locator.fill() aborts with the error shown above.

The expected behavior

role="textbox" should remain on the element regardless of aria-readonly.
With both attributes (role="textbox" aria-readonly="true"), Playwright can interact or wait safely, and assistive technologies keep the correct semantic.

Impact of fix

  • Severity : breaks E2E suites that use Playwright on apps built with Lexical, makes tests flaky.
  • Beneficiaries : Any developers/components/tests that rely on Playwright autowait, plus users of assistive technology (WCAG recommends keeping the role and toggling only aria-readonly).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions