Commit 3f1dfd1
committed
menu: auto-wire parent_menu on submenu items and fix ESC dismiss
Two fixes for submenu dismiss propagation:
1. Auto-wire parent_menu at the start of PopupMenu::render(). Submenus
added via PopupMenuItem::submenu() (the data constructor) don't get
parent_menu set, breaking the dismiss chain. This ensures proper
dismiss propagation regardless of how the submenu was constructed —
including submenus built by table delegates which operate in
Context<TableState>, not Context<PopupMenu>.
2. Fix ESC not closing menus when a submenu is open. When a submenu is
opened by hover, the parent menu retains focus. Pressing ESC would
hit the parent's dismiss(), which bailed out early because
active_submenu() was Some. Now dismiss() clears selected_index first
(closing the submenu) and proceeds with full dismissal.
Fixes #22291 parent b63a12e commit 3f1dfd1
1 file changed
Lines changed: 36 additions & 7 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
752 | 752 | | |
753 | 753 | | |
754 | 754 | | |
755 | | - | |
| 755 | + | |
756 | 756 | | |
757 | 757 | | |
758 | 758 | | |
| |||
762 | 762 | | |
763 | 763 | | |
764 | 764 | | |
765 | | - | |
| 765 | + | |
766 | 766 | | |
767 | 767 | | |
768 | 768 | | |
| |||
929 | 929 | | |
930 | 930 | | |
931 | 931 | | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
932 | 935 | | |
933 | | - | |
934 | | - | |
935 | | - | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
936 | 939 | | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
937 | 943 | | |
938 | 944 | | |
939 | 945 | | |
| |||
948 | 954 | | |
949 | 955 | | |
950 | 956 | | |
951 | | - | |
| 957 | + | |
952 | 958 | | |
953 | 959 | | |
954 | 960 | | |
| |||
967 | 973 | | |
968 | 974 | | |
969 | 975 | | |
970 | | - | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
971 | 985 | | |
972 | 986 | | |
973 | 987 | | |
| |||
1269 | 1283 | | |
1270 | 1284 | | |
1271 | 1285 | | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
1272 | 1301 | | |
1273 | 1302 | | |
1274 | 1303 | | |
| |||
0 commit comments