Skip to content

fix(linux): send integer accessibility states to GTK - #545

Merged
houko merged 2 commits into
mainfrom
fix/linux-a11y-state-types
Nov 18, 2026
Merged

houko merged 2 commits into
mainfrom
fix/linux-a11y-state-types

Conversation

@houko

@houko houko commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #524.

GTK 4 collects the selected and expanded accessibility states, booleans that may be undefined, with g_value_get_int. Linux sent them as boolean GValues, so GTK logged a g_value_get_int critical for each and stored false: AT-SPI clients never heard a view as selected or expanded. Linux now sends both as integer GValues, as it already did for the invalid state. The other boolean states (disabled, hidden, busy) are collected as plain booleans by GTK and keep their boolean GValue.

The regression opens a window on a private D-Bus session with GTK_A11Y=atspi and reads the view's AT-SPI state set through libatspi from a separate process, so the client's synchronous calls cannot dispatch GTK callbacks on the test goroutine. It toggles both states true, false and true, expects a collapsed view to stay expandable, and fails on any g_value_get_int critical. CI installs at-spi2-core for the accessibility bus.

Targets

  • Linux

Screenshots

None: accessibility metadata only.

Verification

  • Rebased on main d55b37b. On the Ubuntu 24.04 GNOME VM, with test binaries built from that base, TestAccessibilitySelectedAndExpandedReachATSPI fails 5 of 5 runs on main's access.go (expandable true, expanded false, selected false, with g_value_get_int criticals) and passes 5 of 5 runs with the fix.
  • Full Linux backend test binary on the same VM (web view tests skipped): main's code logs 2 g_value_get_int criticals and fails the new test; with the fix there are none and 138 tests pass. TestCanvasSamples fails identically on both because the binary runs outside the source tree without its image fixture.
  • go build ./..., go vet ./internal/platform/linux, GOOS=windows go build ./..., GOOS=android GOARCH=arm64 go build ./..., GOOS=js GOARCH=wasm go build ./core: passed.
  • go tool nsgo check -target all: passed.
  • go tool nsgo test -run 'Layer|Skills|Doc' .: 35 passed.
  • Other backends use their own accessibility APIs; this change only corrects the GValue types Linux hands GTK.

Checklist

  • Conventional Commit title.
  • Changelog untouched (frozen until 0.1.0).
  • Draft PR.

@github-actions github-actions Bot added size/S bug Something isn't working documentation Improvements or additions to documentation Linux size/M ci and removed size/S labels Nov 17, 2026
@houko
houko force-pushed the fix/linux-a11y-state-types branch 2 times, most recently from 1c9db13 to 8a10d8a Compare November 18, 2026 01:15
GTK collects the selected and expanded states, booleans that may be undefined, with g_value_get_int. Linux sent them as boolean GValues, so GTK logged a g_value_get_int critical and stored false for both: AT-SPI clients never heard a view as selected or expanded. Send them as integer GValues, as the invalid state already was.

Fixes #524
The regression opens a window on a private D-Bus session with GTK_A11Y=atspi and reads the view's state set through libatspi from a separate process, so the client's synchronous calls cannot dispatch GTK callbacks on the test goroutine. It toggles both states true, false and true, expects the view to stay expandable when collapsed, and fails on any g_value_get_int critical. CI installs at-spi2-core for the accessibility bus.
@houko
houko force-pushed the fix/linux-a11y-state-types branch from 8a10d8a to 263297c Compare November 18, 2026 01:23
@houko

houko commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed. Rebased onto main d55b37b (no conflicts) and checked independently.

  • Code: updateAccess is the only place Linux hands GTK a state GValue. Selected and expanded now go through the integer branch with 0/1, matching GTK's COLLECT_BOOLEAN | COLLECT_UNDEFINED collection. An unset selected or expanded still goes through gtk_accessible_reset_state. Disabled, hidden and busy are plain booleans in GTK and keep their boolean GValue. No CHANGELOG change, no unrelated files, no hard-wrapped commit lines.
  • Ubuntu 24.04 GNOME VM, test binaries built from the rebased branch: with the case line reverted to "invalid" only, TestAccessibilitySelectedAndExpandedReachATSPI failed 5 of 5 runs (AT-SPI expandable true, expanded false, selected false, two g_value_get_int criticals). With the fix it passed 5 of 5, with no criticals, through the true, false, true sequence.
  • Full Linux backend binary on the same VM, web view tests skipped: main's code logs 2 g_value_get_int criticals; with the fix there are 0 and 138 tests pass. The only other failure, TestCanvasSamples, fails identically on both because the binary ran outside the source tree without its image fixture.
  • ubuild: go build ./..., go vet ./internal/platform/linux, gofmt, GOOS=windows go build ./..., GOOS=android GOARCH=arm64 go build ./..., GOOS=js GOARCH=wasm go build ./core and go tool nsgo check -target all all passed.
  • CI runs internal/platform/linux under xvfb in the Linux job, and the job now installs at-spi2-core, so the regression runs there. No other platform's code changed.

@houko
houko marked this pull request as ready for review November 18, 2026 01:24
@houko

houko commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

Reviewed. The only CI failures are unrelated to this change: TestNestedZoomedCanvasIsSharp, fixed on main by #631, and the hosted runner's slow simulator boot, addressed by #634.

@houko
houko merged commit 861c49d into main Nov 18, 2026
24 of 25 checks passed
@houko
houko deleted the fix/linux-a11y-state-types branch November 18, 2026 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci documentation Improvements or additions to documentation Linux size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux: selected and expanded states reach GTK as booleans where it reads ints, so they are always false

1 participant