-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listf: focusFocus traversal, gaining or losing focusFocus traversal, gaining or losing focusfyi-linuxFor the attention of the Linux platform teamFor the attention of the Linux platform teamfyi-macosFor the attention of macOS platform teamFor the attention of macOS platform teamfyi-windowsFor the attention of the Windows platform teamFor the attention of the Windows platform team
Description
Steps to reproduce
Got hit by this assert:
https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/widgets/focus_manager.dart#L1268
We have in our app a FocusScope with children nodes and subnodes.
When I press ESC, the tree underneath the FocusScope is being removed, however the FocusScope in _focusedChildren still lists out indirect children that have been removed.
it looks like we're not updating the _focusedChildren of descendants when removing a child from its parent
I fixed it with this piece of code in _removeChild:
if (removeScopeFocus) {
final enclosingScope = node.enclosingScope;
if (enclosingScope != null) {
enclosingScope?._focusedChildren.remove(node);
for (final descendant in node.descendants) {
if (descendant.enclosingScope == enclosingScope)
enclosingScope?._focusedChildren.remove(descendant);
}
}
}
Expected results
no assert
Actual results
assert triggered
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listf: focusFocus traversal, gaining or losing focusFocus traversal, gaining or losing focusfyi-linuxFor the attention of the Linux platform teamFor the attention of the Linux platform teamfyi-macosFor the attention of macOS platform teamFor the attention of macOS platform teamfyi-windowsFor the attention of the Windows platform teamFor the attention of the Windows platform team