Repository navigation
Conversation
Classic UI Automation has no Switch control type, and the Windows adapter did not implement IScrollProvider for the scroll fields the schema already defines. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request was implemented by an AI agent (Agent).
Role::Switchstays a UI Automation Button because classic UI Automation has no Switch control type. The localized control type isswitch, so a screen reader can announce a switch instead of only a button.ScrollPatternis implemented from existing scroll offsets and directional actions so assistive technology can scroll the container, not onlyScrollIntoView.Localized control type
role_descriptionremains the localization hook (aria-roledescription). When a node sets it, that string is still the localized control type. The Windows adapter has no string catalog of its own. ForRole::Switchwith norole_description, the localized control type is the English tokenswitch, the same string this adapter already returns as the ARIA role. A toolkit that has a translated name can setrole_description. This change does not invent a translated control type or a new UIA control type.ScrollPattern
The shared schema already has
scroll_x/scroll_y(with min and max),Action::ScrollUp,ScrollDown,ScrollLeft, andScrollRightwithActionData::ScrollUnit, andAction::SetScrollOffset. No parallel event protocol was added.(current - min) / (max - min) * 100, orUIA_ScrollPatternNoScrollwhen that axis has no range.scroll_*_max - scroll_*_minas the hidden remainder:100 * viewport / (viewport + range). There is no separate viewport field in the schema. If the bounds or the range are missing, the view size is reported as 100 rather than inventing a content size.IScrollProvider::ScrollmapsScrollAmountonto the existing directional actions. Small amounts useScrollUnit::Itemand large amounts useScrollUnit::Page. Increment moves toward a larger scroll offset.SetScrollPercentmaps toAction::SetScrollOffsetwhen that action is supported.UIA_ScrollPatternNoScroll(-1) leaves that axis unchanged. If the node does not supportSetScrollOffset, the call returnsUIA_E_NOTSUPPORTED.The pattern is exposed when an axis has a positive scroll range or a directional scroll action. That includes
Role::ScrollViewand other roles that carry the same fields, such as a list.Action::ScrollIntoViewby itself still only enablesScrollItemPattern.Verification
cargo test -p accesskit_windows -- --test-threads=1: 19 passed, 0 failed, including window teststests::simple::has_native_uia,navigation,focus, andtests::subclassed::has_native_uia,double_instantiate.cargo clippy -p accesskit_windows --all-targets -- -D warnings: no warnings.NVDA 2026.1.1, eSpeak NG 1.52.0, spoken lines:
Speaking ['Night mode', 'toggle button', 'not pressed'];Speaking ['Inbox offset 40'];Speaking ['Inbox offset 100']. UIA control type remained Button (50000). Localized control type wasswitch.Scroll(NoAmount, SmallIncrement)moved vertical percent 0 to 20 (offset 40).SetScrollPercent(NoScroll, 50)set offset 100 and vertical percent 50.Narrator speech history:
AccessKitSwitchScroll 区域, Night mode, switch, 关闭andInbox offset 0. Narrator used the localized control typeswitch. NVDA and Narrator were quit afterward.If this implementation style does not match project requirements, maintainers can ask for changes and the author will update the pull request, or they can close the pull request directly. Either outcome is fine.