Name Steam popups and tabs, skip empty editor placeholder

Steam popup documents spoke their internal names (QuickAccess_uid2);
they now say "Quick Access" and "Main Menu". The unnamed Quick Access
tab is named Friends from its quickaccess_tab id. An empty rich editor
whose text is only an object replacement character (ChatGPT's message
box) no longer speaks that character on focus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Storm DragonandClaude Opus 5.5 committed 2026-12-01 02:52:44 -05:00
1 parent 7b4fca03bf
commit d47a0c0d5d
5 files changed
+73 -1

No files matched your search

+33
View File
@@ -44,6 +44,39 @@ func GamepadPopupDocument(processName, documentName string) bool {
return MatchProcess(processName) == Steam && steamPopupDocument.MatchString(strings.TrimSpace(documentName))
}
// Steam's Quick Access tab keys, from its client UI. Some tabs, such as
// Friends, carry an icon and no aria-label, so their tab has no name.
var steamQuickAccessTabs = map[string]string{
"quickaccess_tab_0": "Notifications",
"quickaccess_tab_1": "Remote Play Together",
"quickaccess_tab_2": "Voice Chat",
"quickaccess_tab_3": "Friends",
"quickaccess_tab_4": "Quick Settings",
"quickaccess_tab_5": "Performance",
"quickaccess_tab_6": "Help",
"quickaccess_tab_7": "Soundtracks",
}
var steamPopupNameWord = regexp.MustCompile(`[A-Z][a-z0-9]*|[a-z0-9]+`)
// SteamName replaces names Steam leaves internal or empty: a popup document's
// browser name ("QuickAccess_uid2" becomes "Quick Access") and an unnamed
// Quick Access tab. It returns false when the name should stay as it is.
func SteamName(processName, role, name, elementID string) (string, bool) {
if MatchProcess(processName) != Steam {
return "", false
}
switch {
case role == "document web" && GamepadPopupDocument(processName, name):
base, _, _ := strings.Cut(strings.TrimSpace(name), "_uid")
return strings.Join(steamPopupNameWord.FindAllString(base, -1), " "), true
case role == "page tab" && strings.TrimSpace(name) == "":
title, ok := steamQuickAccessTabs[elementID]
return title, ok
}
return "", false
}
// ToastDocument reports Steam's toast popup, named notificationtoasts_uid<n>-<id>
// in Big Picture and notificationtoasts_<id>_desktop otherwise. Live regions
// elsewhere, such as the store's event calendar, are page content, not toasts.
+21
View File
@@ -174,3 +174,24 @@ func TestToastDocument(t *testing.T) {
}
}
}
func TestSteamName(t *testing.T) {
for _, test := range []struct {
process, role, name, elementID, want string
ok bool
}{
{"steamwebhelper", "document web", "QuickAccess_uid2", "", "Quick Access", true},
{"steamwebhelper", "document web", "MainMenu_uid12", "", "Main Menu", true},
{"steamwebhelper", "document web", "Steam Big Picture Mode", "", "", false},
{"steamwebhelper", "page tab", "", "quickaccess_tab_3", "Friends", true},
{"steamwebhelper", "page tab", "Notifications", "quickaccess_tab_0", "", false},
{"steamwebhelper", "page tab", "", "other_tab", "", false},
{"chrome", "page tab", "", "quickaccess_tab_3", "", false},
{"chrome", "document web", "QuickAccess_uid2", "", "", false},
} {
got, ok := SteamName(test.process, test.role, test.name, test.elementID)
if got != test.want || ok != test.ok {
t.Errorf("SteamName(%q, %q, %q, %q) = %q, %v; want %q, %v", test.process, test.role, test.name, test.elementID, got, ok, test.want, test.ok)
}
}
}