fix(a11y): treat inert elements and content outside of modal dialogs as hidden

Merged
DG
1mo ago
+496-32

Summary

  • Elements with the inert attribute, their descendants, and everything outside of the topmost modal <dialog> are now hidden for aria: excluded from getByRole(), aria snapshots and accessible names, with no refs in the AI snapshot.
  • New internal "not inert" actionability check for click-like actions and fill(), so they wait instead of silently misfiring.
  • PLAYWRIGHT_SKIP_INERT_CHECK disables all inert checks, PLAYWRIGHT_SKIP_DIALOG_CHECK disables only the modal dialog check.

Fixes https://github.com/microsoft/playwright/issues/36938
Fixes https://github.com/microsoft/playwright/issues/42967

Related earlier attempts: