Keep summaries in browse mode, focus splitters, speak checked tree items
Adopt three current Orca web behaviors: - A native <summary> no longer forces focus mode, so its expanded details can be read without switching back (Orca issue #543). ARIA disclosure buttons keep focus mode. - A focusable separator is a splitter and uses focus mode so arrow keys resize the panes. Static separators stay in browse mode. - Checkable tree items present checked, not checked or partially checked on focus and on state change (Orca issue #777). The web-widgets native proof records Chromium's exposure of each widget. Verified live in Brave with tests/browser-web-widgets.html. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
996685539a
commit
210e949f76
7 files changed
+142
-2
No files matched your search
@@ -152,7 +152,13 @@ func (state *DocumentModeState) decide(input ModeInput, settings ModeSettings) D
|
||||
func focusModeWidget(input ModeInput) bool {
|
||||
object := input.Context.Ancestors[0]
|
||||
traits := input.Traits
|
||||
if object.Editable || object.Expandable && object.Focusable && object.Role != "link" {
|
||||
// A native <summary> stays in browse mode so its expanded details can be
|
||||
// read without switching back (Orca issue #543).
|
||||
if object.Editable || object.Expandable && object.Focusable && object.Role != "link" && object.HTMLTag != "summary" {
|
||||
return true
|
||||
}
|
||||
// A focusable separator is a splitter: arrow keys resize the panes.
|
||||
if object.Role == "separator" && object.Focusable {
|
||||
return true
|
||||
}
|
||||
switch object.Role {
|
||||
|
||||
@@ -217,3 +217,26 @@ func TestDocumentModeUnknownStates(t *testing.T) {
|
||||
t.Fatalf("recaptured states did not restore mode: %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDocumentModeSummaryAndSplitter(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
snapshot atspi.Snapshot
|
||||
want DocumentMode
|
||||
}{
|
||||
{"native summary", atspi.Snapshot{Role: "toggle button", HTMLTag: "summary", Focusable: true, Expandable: true, Expanded: true}, BrowseMode},
|
||||
{"aria disclosure button", atspi.Snapshot{Role: "toggle button", HTMLTag: "div", Focusable: true, Expandable: true}, FocusMode},
|
||||
{"focusable splitter", atspi.Snapshot{Role: "separator", HTMLTag: "div", Focusable: true}, FocusMode},
|
||||
{"static separator", atspi.Snapshot{Role: "separator", HTMLTag: "hr"}, BrowseMode},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
input := modeInput(t, test.snapshot.Role)
|
||||
test.snapshot.StatesKnown = true
|
||||
input.Context.Ancestors[0] = test.snapshot
|
||||
var state DocumentModeState
|
||||
if got := state.Update(input, DefaultModeSettings()); got != test.want {
|
||||
t.Fatalf("got %v, want %v", got, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user