react-spectrum
a7b85809 - feat: Add subdialog support to Menu and Autocomplete (#7561)

Commit
354 days ago
feat: Add subdialog support to Menu and Autocomplete (#7561) * rough start * fix contain * debug ESC handler * fix rendering of subdialog in autocomplete * debug dynamic case and fix context * handle submenutriggers in base collection filtering and fix id issue for trigger * prevent focus from being lost to the body when submenutrigger is virtually focused typically submenus dont have focus restore turned on since it would move focus manually back to the trigger when keyboard closing the menu. However, we cant move focus to virtually focused triggers so enable focus restore on the submenu in these cases * ensure that the focused subdialogtrigger item remains focused after opening and closing the subdialog * close submenu when virtual focus moves off trigger and properly dispatch events to the temporarily cleared focus item the second part of this message refers to the following flow: over submenu via hover in autocomplete, use arrowLeft to close it and then try to reopen it via arrowRight * fix hover for now so I can debug the focus issues * fix tab handling in subdialogs and opening submenus on mobile when using virtual focus * Fix to close submenus/dialogs when in a Autocomplete that isnt in a popover itself * fix issue where you cant shift tab from the Autocompletes text field * fix shift tabbing from closing the subdialogs when rendered by Autocomplete menu * make sure expanded triggers dont have visible focus ring * fix all subdialog being closed when using ESC on a subMenuTrigger and partial fix for only closing submenu via ESC if opened from sub dialog this defers ESC handling to the menu/dialog at all times. The previous bug https://github.com/adobe/react-spectrum/commit/3f8e6e0e1ea3b88db912d2ce7b7b6935441fd8bb seems to not happen anymore * update mobile screen reader behavior so focus is restored to the subtrigger when dimissing the submenu/dialog also subdialog component renaming from team discussion and adding enterkeyhint for autocomplete * only close outer most submenu/subdialog when using ESC for consistency between a chain of submenus and a mixed chain of submenus/subdialogs. This is consistent with Windows as well, but not with MacOS * partial fix to only persist a single focus ring on item or input for virtual focus * Making focus ring appear on virtually focused items and on input field if none exist Applies to virtual focus menus and listboxes. Only affects RAC for now * simplifiying useSelectableItem change in favor of proper manager.isFocused tracking this includes a fix to where hovering an adjacent item to close a open submenu in an autocomplete wasnt making the hovered item properly focused * saving point for tests * Fix focusscope for subdialogs and add test * Fix S2 autocomplete double focus ring * adding tests for subdialog and testing useInteractOutside for subdialogs again * add submenu tests * fix ESC closing multiple levels of subdialogs/menus due to collection event leak to test, open a subdialog with auto complete -> submenu -> subdialog with autocomplete and hits ESC * hack around react 16 failures for now * fix lint * fix react 16, close menu on hovering different item * fixing lint * wip: refactor to fire fake focus/blur events * fix more * implement keepVisible for non-modal popovers * refactor * update lock * lint * fix 16 * fix test * Clear MenuContext in SubDialog Otherwise menus in SubDialogs inside SubMenus will also handle keyboard events, resulting in multiple levels closing at once * Fix dismiss on interact outside * Use focusedNodeId ref for keyboard handlers to avoid race condition * refactor listbox filtering to support usage inside Select * Make sure props are sent to the right elements * fix RSP * cleanup * fix react 16/17 * Revert "fix react 16/17" This reverts commit e03daa4f6dad1b0c89a6027571972060ed36a1ac. * Revert "fix RSP" This reverts commit 77148f5b9aaa154aed626fd2028315160f9f62ef. * Revert "Fix dismiss on interact outside" This reverts commit f6b72721360d8cafaf121336127d77f0e580430c. * Fix interact outside for RAC submenu/subdialogs specifically * revert dialog change * more cleanup * Use getActiveElement utility * focus input when clicking on collection * fix merge * Refactor left/right arrow key behavior to be less menu specific * Remove onDismissButtonPress for now Can't reproduce original issue anymore * lint --------- Co-authored-by: Devon Govett <devongovett@gmail.com>
Author
Parents
Loading