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
@@ -0,0 +1,81 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// Authors: Storm Dragon, Angus Kola
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package atspi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Records how the browser exposes the widgets behind three web mode and
|
||||
// presentation rules: a native disclosure summary, a focusable splitter, and
|
||||
// checkable tree items. The reader's rules depend on these exact traits.
|
||||
func TestNativeBrowserWebWidgetTraits(t *testing.T) {
|
||||
if os.Getenv("CTHULHU_NATIVE_BROWSER") != "1" {
|
||||
t.Skip("requires private browser session")
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
defer cancel()
|
||||
adapter := New()
|
||||
if err := adapter.Start(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer adapter.Stop(context.Background())
|
||||
if _, err := adapter.CaptureDesktop(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Browse mode decides from document captures, which carry HTML tags.
|
||||
// Anchor the capture on the page's own focused button.
|
||||
if out, err := exec.CommandContext(ctx, "xdotool", "key", "--clearmodifiers", "Tab").CombinedOutput(); err != nil {
|
||||
t.Fatalf("move focus: %v %s", err, out)
|
||||
}
|
||||
var focus ObjectID
|
||||
for !focus.Valid() {
|
||||
select {
|
||||
case event := <-adapter.Events():
|
||||
if (event.Type == FocusedStateEvent || event.Type == FocusEvent) && event.Detail1 == 1 && event.Source.Name == "Disclosure summary" {
|
||||
focus = event.Source.ID()
|
||||
}
|
||||
case <-ctx.Done():
|
||||
t.Fatal("focus event in the page missing")
|
||||
}
|
||||
}
|
||||
document, err := adapter.CaptureDocument(ctx, focus)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
resolve := func(name string) Snapshot {
|
||||
t.Helper()
|
||||
snapshot, err := document.Resolve(findNamedReference(t, document, name))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("%s: role=%q tag=%q focusable=%v expandable=%v expanded=%v checkable=%v checked=%v xml-roles=%q",
|
||||
name, snapshot.Role, snapshot.HTMLTag, snapshot.Focusable, snapshot.Expandable, snapshot.Expanded,
|
||||
snapshot.Checkable, snapshot.Checked, snapshot.XMLRoles)
|
||||
return snapshot
|
||||
}
|
||||
if summary := resolve("Disclosure summary"); summary.HTMLTag != "summary" || summary.Role != "toggle button" || !summary.Focusable || !summary.Expandable {
|
||||
t.Errorf("summary traits: %+v", summary)
|
||||
}
|
||||
if splitter := resolve("Pane splitter"); splitter.Role != "separator" || !splitter.Focusable {
|
||||
t.Errorf("splitter traits: %+v", splitter)
|
||||
}
|
||||
if static := resolve("Static separator"); static.Role != "separator" || static.Focusable {
|
||||
t.Errorf("static separator traits: %+v", static)
|
||||
}
|
||||
if checked := resolve("Checked option"); checked.Role != "tree item" || !checked.Checkable || !checked.Checked {
|
||||
t.Errorf("checked tree item traits: %+v", checked)
|
||||
}
|
||||
if unchecked := resolve("Unchecked option"); !unchecked.Checkable || unchecked.Checked {
|
||||
t.Errorf("unchecked tree item traits: %+v", unchecked)
|
||||
}
|
||||
if plain := resolve("Plain option"); plain.Checkable {
|
||||
t.Errorf("plain tree item reported checkable: %+v", plain)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user