docs(electron): say which queries find an inert element

Merged
OK
16h ago
+3-3

What

Three docs rows about elements behind a modal now match what the Electron engine does: getByText, getByTestId, and electron.locator() find an element in an inert subtree, getByRole and getByLabel don't, and input to it, such as tap() or fill(), fails with it is inert.

Why

Both rows were written for #2406 and said no screen query finds an inert element. #2420 made getByText find text under inert, and #2419 made actions on an inert control fail, so the rows were wrong on main.

How it works

  1. docs/electron.mdx, "What differs from the web", the "Finding elements" row, and the same row in docs/reference/electron.mdx, which #2448 added.
  2. docs/migrate/playwright.mdx, "Electron apps", the row for a query behind an open modal.

Issue

None.

Verified

Ran it locally: yes

Surface: the built CLI from main (3834ab7) on Insomnia with its Preferences modal open, which react-aria makes the rest of the page inert for.

electron.locator('[data-testid="quick-search"]').count()      1
screen.getByTestId('quick-search').count()                    1
screen.getByText('New Project').count()                       1
screen.getByRole('button', { name: 'Create new Project' })    0
screen.getByLabel('Import').count()                           0
click on any of the three found                               ACTION_FAILED: the element cannot take the action: it is inert (a modal or the app blocks it)

pnpm docs:check passes. No screenshot of the rendered page: two table cells changed wording only.

Summary by CodeRabbit

  • Documentation
    • Clarified how element queries behave inside inert areas, including behind open modals.
    • Documented which query methods can find these elements and that actions such as tapping or filling them fail.