Announce popup state for buttons and links
This commit is contained in:
1 parent
4c95c9f278
commit
abb4890e8a
3 files changed
+30
No files matched your search
@@ -124,6 +124,12 @@ func controlStates(snapshot atspi.Snapshot) []string {
|
||||
states = append(states, "collapsed")
|
||||
}
|
||||
}
|
||||
if snapshot.HasPopup {
|
||||
switch snapshot.Role {
|
||||
case "button", "push button", "toggle button", "link":
|
||||
states = append(states, "has popup")
|
||||
}
|
||||
}
|
||||
if snapshot.Selected && presentsSelectedState(snapshot.Role) {
|
||||
states = append(states, "selected")
|
||||
}
|
||||
|
||||
@@ -209,3 +209,20 @@ func TestSliderFocusUsesCurrentValueInsteadOfStaleText(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestPopupControlPresentation(t *testing.T) {
|
||||
for _, role := range []string{"button", "push button", "toggle button", "link", "combo box", "text"} {
|
||||
t.Run(role, func(t *testing.T) {
|
||||
plain := atspi.Snapshot{Name: "Options", Role: role}
|
||||
popup := plain
|
||||
popup.HasPopup = true
|
||||
want := FocusText(plain)
|
||||
if role == "button" || role == "push button" || role == "toggle button" || role == "link" {
|
||||
want += ", has popup"
|
||||
}
|
||||
if got := FocusText(popup); got != want {
|
||||
t.Fatalf("popup focus = %q, want %q", got, want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -86,3 +86,10 @@ func TestDocumentLineSoundPolicy(t *testing.T) {
|
||||
t.Fatalf("speech-only text = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDocumentLinePopupCue(t *testing.T) {
|
||||
line := atspi.DocumentLine{Contents: []atspi.DocumentContent{{Snapshot: atspi.Snapshot{Role: "button", HasPopup: true}, Text: "Options"}}}
|
||||
if got := DocumentLineText(line); got != "Options, button, has popup" {
|
||||
t.Fatalf("popup line = %q", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user