diff --git a/.changeset/large-actors-reply.md b/.changeset/large-actors-reply.md new file mode 100644 index 0000000000..6635de2fc3 --- /dev/null +++ b/.changeset/large-actors-reply.md @@ -0,0 +1,7 @@ +--- +'@primer/view-components': minor +--- + +Fix multi-select behavior when ActionMenus are embedded in dialogs + + diff --git a/app/components/primer/alpha/action_menu/action_menu_element.ts b/app/components/primer/alpha/action_menu/action_menu_element.ts index f13539c9ce..66815487b0 100644 --- a/app/components/primer/alpha/action_menu/action_menu_element.ts +++ b/app/components/primer/alpha/action_menu/action_menu_element.ts @@ -172,11 +172,6 @@ export class ActionMenuElement extends HTMLElement { return } - // Ignore events within dialogs within menus - if ((event.target as Element)?.closest('dialog') || (event.target as Element)?.closest('modal-dialog')) { - return - } - if (event.type === 'focusout') { if (this.#invokerBeingClicked) return diff --git a/test/system/alpha/action_menu_test.rb b/test/system/alpha/action_menu_test.rb index 95c066fc3a..557e192591 100644 --- a/test/system/alpha/action_menu_test.rb +++ b/test/system/alpha/action_menu_test.rb @@ -346,7 +346,7 @@ def test_opens_dialog click_on_invoker_button click_on_second_item - assert_selector "modal-dialog#my-dialog" + assert_selector "modal-dialog[open]" # opening the dialog should close the menu refute_selector "action-menu ul li" @@ -523,6 +523,9 @@ def test_deferred_dialog_opens click_on_fourth_item assert_selector "modal-dialog[open]" + + # menu should close + refute_selector "action-menu ul li" end def test_opening_second_menu_closes_first_menu