Skip to content

select: expose committed values and accessible activation - #4

Closed
grishy wants to merge 3 commits into
sg-review-basefrom
sg-select-accessibility
Closed

select: expose committed values and accessible activation#4
grishy wants to merge 3 commits into
sg-review-basefrom
sg-select-accessibility

Conversation

@grishy

@grishy grishy commented Sep 5, 2026

Copy link
Copy Markdown
Owner

On macOS, Select's AXPopUpButton has no current value or AXPress action. Its trigger child can be flattened out of the accessibility tree, so the child's click handler is not enough.

This exposes activation on the enabled root and supplies the committed selection as its accessible value. It reuses the existing open-state callback and focus handles. The value includes the item's title and prefix, or the placeholder when unselected. Filtering does not change it. Base Select exposes .accessibility_value(...) for application-owned values.

Screenshots

These screenshots are only for context. They show two states of the same example, not a visual before/after change.

Go selected Searching for Rust
Select with Go committed and focus on the trigger Select open with Rust in the search field

Accessibility check

While searching for Rust, the root still reports the committed value Go. Captured from the macOS accessibility tree:

{
  "role": "AXPopUpButton",
  "title": "Programming language",
  "value": "Language: Go",
  "actions": ["AXPress"]
}

How to Test

MTL_HUD_ENABLED=1 ./script/run-story-macos Select

Scroll to Search and find Programming language in macOS Accessibility Inspector.

  1. Invoke AXPress, type Go, and press Enter. Expect Language: Go, a closed popup, and focus on the trigger.
  2. Reopen, clear the query, and type Rust. The accessible value must remain Language: Go.
  3. Invoke AXPress to close. Check focus returns. Also check Down opens and Escape closes.
  4. Inspect the Disabled example. It must have no AXPress action.
Automated checks
cargo test -p gpui-base -p gpui-component --lib --locked
cargo clippy -p gpui-base -p gpui-component -p gpui-component-story --all-targets --locked -- -D warnings

771 base and 419 component tests passed, along with strict Clippy and formatting. Regression coverage includes accessible metadata, disabled activation, filtering, prefixes, and placeholder fallback after clearing.

Windows and Linux runtime were not tested. Visual search preview and the existing disabled-root AXEnabled=1 reporting are outside this patch.

Checklist

  • Read CONTRIBUTING.md and followed the guidelines.
  • Reviewed the final patch, including the AI-assisted changes.
  • Manually tested the related Story examples on macOS.

AI assistance

I tested the original change in my application, then asked OpenAI's gpt-6-astra to extract it into a PR. The agent prepared the code, tests, verification scripts, and description, and ran the automated checks. I reviewed the extracted patch and manually tested the scenarios above on macOS using Accessibility Inspector.

Expose the committed value rather than the temporary search cursor.
Handle accessible activation on the semantic root because native accessibility
can flatten the painted trigger child.
@grishy

grishy commented Sep 5, 2026

Copy link
Copy Markdown
Owner Author

Continued upstream in longbridge#2973.

@grishy grishy closed this Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant