fix(hierarchy): reach the accessible label through every name for it

label and accessibilityLabel aliased onto accessibilityText alone, which
only the ios sidecar writes, and alias expansion is ONE level: the hop
from accessibilityText to content-desc was never taken, so both keys
matched nothing on android and on the chrome dump, which write the fact
under content-desc. ariaLabel and contentDescription aliased onto
nothing at all and matched nothing anywhere.

The web runtime resolves all four against the live DOM, so a selector
naming a field this way found it on one host and no element at all on
the other. The keys are accepted, so no unknown-key error fires, and a
property over the element that was never found passes having checked
nothing.

Each name lists both keys rather than chaining through accessibilityText:
transitive expansion would silently widen every existing key at once.
This commit is contained in:
pj committed 2026-08-19 10:06:56 +05:30
1 parent 5a7c223464
commit ae629d9d7d
2 files changed
+69 -3

No files matched your search

+8 -3
View File
@@ -259,9 +259,14 @@ type AttrFilter struct {
var attributeAliases = map[string][]string{
// Android XML legacy name; web driver uses content-desc; the sidecar normalises to accessibilityText
"content-desc": {"accessibilityText"},
// iOS AXElement / UIKit names
"label": {"accessibilityText"},
"accessibilityLabel": {"accessibilityText"},
// Every other name for the accessible label. Alias expansion is one level,
// so each name lists both keys a producer writes the fact under rather than
// hopping through accessibilityText: android and the chrome dump write
// content-desc, the ios sidecar writes accessibilityText.
"label": {"accessibilityText", "content-desc"},
"accessibilityLabel": {"accessibilityText", "content-desc"},
"ariaLabel": {"accessibilityText", "content-desc"},
"contentDescription": {"accessibilityText", "content-desc"},
// accessibilityText is the canonical key; also check content-desc for Android/web
"accessibilityText": {"content-desc"},
// resource-id canonical key; also check identifier (iOS AXElement raw field)