fix(chrome): state every boolean flag the dump can state

internal/hierarchy writes the attribute a selector matches on only where
the producer stated the flag, so a state emitted as null is one no
selector can ask about: {clickable: false} and {enabled: false} matched
nothing at all against a web dump while matching on android, which
states every flag both ways. only secure stays three-valued.
This commit is contained in:
pj committed 2026-08-18 20:43:29 +05:30
1 parent d177726c4e
commit c8ca350115
1 file changed
+10 -5
+10 -5
View File
@@ -739,13 +739,18 @@ func (d *Driver) Hierarchy(ctx context.Context) (string, error) {
return { return {
attributes: attrs, attributes: attrs,
children: children, children: children,
clickable: isClickable || null, // Emitted as plain booleans, never null: internal/hierarchy writes the
enabled: isEnabled(el) || null, // attribute a selector matches on only where the producer stated the
focused: focusedElement === el || null, // flag, so a state that arrives as null is one no selector can ask about.
// {clickable: false} and {enabled: false} matched nothing at all here
// while matching on android, which states every flag both ways.
clickable: isClickable,
enabled: isEnabled(el),
focused: focusedElement === el,
// A component keeps what it likes in these two properties, so what is // A component keeps what it likes in these two properties, so what is
// emitted is the flag the field declares and not the property's value. // emitted is the flag the field declares and not the property's value.
checked: el.checked === true || null, checked: el.checked === true,
selected: el.selected === true || null, selected: el.selected === true,
// Emitted as a plain boolean, never null, on every editable field: a // Emitted as a plain boolean, never null, on every editable field: a
// consumer deciding what a typed value may be recorded as has to tell // consumer deciding what a typed value may be recorded as has to tell
// "not a secure entry" apart from "nobody said", and android says nothing. // "not a secure entry" apart from "nobody said", and android says nothing.