Skip to content

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

Closed

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).

Activity

  1. etrepum commented on Apr 29, 2025

    @etrepum
    Collaborator

    Looks like this was changed in #6381 for some reason, @zurfyx?

  2. so99ynoodles commented on Jun 21, 2025

    @so99ynoodles
    Contributor

    any progress on this?
    @zurfyx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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