Commit ce07864
committed
Fix focus routing for mouse clicks and ClearContents in ScrollablePanel
- HandleClickFocus: use deep leaf (via _lastDeepFocusedControl) as
FocusService target instead of the container, matching SwitchFocus
behaviour. Previously, SetFocus(container) cleared the leaf child's
HasFocus, causing it to ignore key events after a mouse click.
- ScrollablePanelControl.ClearContents: remove the SetFocus(false) call
that fired when _hasFocus && !CanReceiveFocus (after children cleared).
The panel now retains _hasFocus=true so focus is restored automatically
when new controls are added.
- ScrollablePanelControl.AddControl: auto-focus the first focusable
control added while the panel has focus but no focused child. Restores
key routing after ClearContents without losing the panel's focus.
- HasActiveInteractiveContent: add a second fallback that checks
_lastDeepFocusedControl.HasFocus when the container's HasFocus was
cleared by FocusService.SetFocus(leaf) in NotifyControlGainedFocus.1 parent cb8c143 commit ce07864
3 files changed
Lines changed: 29 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1000 | 1000 | | |
1001 | 1001 | | |
1002 | 1002 | | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
1003 | 1015 | | |
1004 | 1016 | | |
1005 | 1017 | | |
| |||
1052 | 1064 | | |
1053 | 1065 | | |
1054 | 1066 | | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | 1067 | | |
1059 | 1068 | | |
1060 | 1069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1813 | 1813 | | |
1814 | 1814 | | |
1815 | 1815 | | |
| 1816 | + | |
1816 | 1817 | | |
1817 | 1818 | | |
1818 | 1819 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
355 | 361 | | |
356 | 362 | | |
357 | 363 | | |
| |||
625 | 631 | | |
626 | 632 | | |
627 | 633 | | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
628 | 643 | | |
629 | 644 | | |
630 | 645 | | |
| |||
0 commit comments