mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
fix(verifier): label editable fields by hint, not the typed value
an editable field's own text is its transient content; prefer the hint so the field is named by purpose and the label stays stable.
This commit is contained in:
1 parent
9845b89173
commit
b65b8373e6
2 files changed
+26
No files matched your search
@@ -581,6 +581,13 @@ func buildNodeIndex(tree *hierarchy.Tree) map[*hierarchy.Element]*hierarchy.Node
|
||||
// case that fixes empty-text Compose buttons whose word lives on a child), then
|
||||
// its class as a last resort.
|
||||
func visibleLabel(element *hierarchy.Element, nodeIndex map[*hierarchy.Element]*hierarchy.Node) string {
|
||||
// An editable field's own text is the transient typed value ("1"); its hint
|
||||
// names its purpose ("Amount") and stays stable, so prefer the hint there.
|
||||
if element.Editable {
|
||||
if hint := element.Attributes["hintText"]; hint != "" {
|
||||
return truncateLabel(hint)
|
||||
}
|
||||
}
|
||||
if element.Text != "" {
|
||||
return truncateLabel(element.Text)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user