This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -527,11 +527,12 @@ void AccessibilityBridge::SetTooltipFromFlutterUpdate(
527527void AccessibilityBridge::SetTreeData (const SemanticsNode& node,
528528 ui::AXTreeUpdate& tree_update) {
529529 FlutterSemanticsFlag flags = node.flags ;
530- // Set selection if:
530+ // Set selection of the focused node if:
531531 // 1. this text field has a valid selection
532532 // 2. this text field doesn't have a valid selection but had selection stored
533533 // in the tree.
534- if (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsTextField ) {
534+ if (flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsTextField &&
535+ flags & FlutterSemanticsFlag::kFlutterSemanticsFlagIsFocused ) {
535536 if (node.text_selection_base != -1 ) {
536537 tree_update.tree_data .sel_anchor_object_id = node.id ;
537538 tree_update.tree_data .sel_anchor_offset = node.text_selection_base ;
Original file line number Diff line number Diff line change @@ -42,13 +42,17 @@ void AccessibilityBridgeWindows::OnAccessibilityEvent(
4242 ax::mojom::Event::kChildrenChanged );
4343 break ;
4444 case ui::AXEventGenerator::Event::DOCUMENT_SELECTION_CHANGED: {
45+ // An event indicating a change in document selection should be fired
46+ // only for the focused node whose selection has changed.
4547 ui::AXNode::AXID focus_id = GetAXTreeData ().sel_focus_object_id ;
4648 auto focus_delegate =
4749 GetFlutterPlatformNodeDelegateFromID (focus_id).lock ();
48- DispatchWinAccessibilityEvent (
49- std::static_pointer_cast<FlutterPlatformNodeDelegateWindows>(
50- focus_delegate),
51- ax::mojom::Event::kDocumentSelectionChanged );
50+ if (focus_delegate) {
51+ DispatchWinAccessibilityEvent (
52+ std::static_pointer_cast<FlutterPlatformNodeDelegateWindows>(
53+ focus_delegate),
54+ ax::mojom::Event::kDocumentSelectionChanged );
55+ }
5256 break ;
5357 }
5458 case ui::AXEventGenerator::Event::FOCUS_CHANGED:
You can’t perform that action at this time.
0 commit comments