Skip to content

Commit 91bf454

Browse files
committed
fix: keep rail destination tooltips out of merged semantics nodes
A Tooltip links its overlay content to the anchor with a traversal-parent identifier, and the rail merges its vertically adjacent destinations into one semantics node, dropping that identifier instead of combining it. The orphaned tooltip node then points outside the tree and Windows rejects the whole accessibility update with "Failed to update ui::AXTree, error: N will not be in the tree and is not the new root" (flutter/flutter#182444). Wrapping each anchor in Semantics(container: true) keeps it un-mergeable.
1 parent b639159 commit 91bf454

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎lib/features/function_page.dart‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,10 +783,19 @@ NavigationRailDestination _tooltippedDestination(
783783
final tooltip = _destinationTooltip(ref, destination.label);
784784
if (tooltip == null) return destination;
785785
return NavigationRailDestination(
786-
icon: Tooltip(message: tooltip, child: destination.icon),
786+
// `container: true` keeps each rail destination its own semantics node so
787+
// adjacent destinations cannot absorb one another's tooltip anchor and
788+
// orphan its overlay node. See flutter/flutter#182444.
789+
icon: Tooltip(
790+
message: tooltip,
791+
child: Semantics(container: true, child: destination.icon),
792+
),
787793
selectedIcon: Tooltip(
788794
message: tooltip,
789-
child: _selectedRailIcon(context, destination.selectedIcon),
795+
child: Semantics(
796+
container: true,
797+
child: _selectedRailIcon(context, destination.selectedIcon),
798+
),
790799
),
791800
label: destination.label,
792801
padding: destination.padding ?? const EdgeInsets.symmetric(vertical: 3),

0 commit comments

Comments
 (0)