/** * Environment-agnostic checked/disabled policy shared by `DOMInteractor` and * `PlaywrightInteractor` so the two cannot drift, the same way * `visibilityUtil.isElementVisibleByStyle` is shared (#1053). * * Before this existed the two engines answered differently and neither answer was * written down: the DOM leg read only native IDL properties, while the Playwright * leg delegated to Playwright's own primitives, which follow labels, consult * `aria-checked`, honour a disabled `
`/``, and walk ancestors * for `aria-disabled`. Any test asserting a design-system control's state got a * different answer per runner. Defining the predicate once and running it in both * places makes them agree by construction rather than by parallel maintenance. * * Both functions are passed BY VALUE into Playwright's `page.evaluate`, which * serializes them to the browser. They must therefore stay self-contained: they may * reference only their parameters and DOM globals, never an import, a module-scope * constant, or a Node object — which is why the role list below is inlined rather * than hoisted. Keep them synchronous and free of constructs that transpile to * injected runtime helpers. */ /** * Whether the element is checked, via the native `checked` property of an * ``/``, or `aria-checked="true"` on an * element whose explicit `role` is a checkable one. * * `aria-checked="mixed"` and a native `indeterminate` control both report `false`: * this contract is two-state, and "partially checked" is not "checked". An element * that cannot be checked at all reports `false` rather than throwing, so the read * stays total in both engines. * * @param element - The element whose checked state is being decided. It must be the * control itself; a `