Skip to content

fix(popover, combobox, dropdown, tooltip): keep Escape from closing the Modal around them - #1258

Merged
maiieul merged 2 commits into
qwikifiers:mainfrom
maiieul:fix/escape-in-modal
Nov 29, 2026
Merged

maiieul merged 2 commits into
qwikifiers:mainfrom
maiieul:fix/escape-in-modal

Conversation

@maiieul

@maiieul maiieul commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What is it?

  • Bug

Description

Closes #1250. Escape in an open Popover, Combobox, Dropdown or Tooltip inside a Modal also closed the Modal. Each now stops the key while it's open, as Select has done since #1243. A Popover only stops it when its open panel is an auto popover, so an open manual popover still lets Escape close the Modal. A Tooltip stops it from a document handler, since focus may be anywhere in the modal while the tooltip is hovered.

<Modal.Root bind:show={isOpen}>
  <Modal.Trigger>Open modal</Modal.Trigger>
  <Modal.Panel>
    <Popover.Root>
      <Popover.Trigger>Open popover</Popover.Trigger>
      <Popover.Panel>Popover content</Popover.Panel>
    </Popover.Root>
  </Modal.Panel>
</Modal.Root>

One Escape with the Popover open:

Popover Modal
Before stays open closes
After closes stays open
popover.test.ts
└─ Keyboard Behavior
   + Escape on the trigger of a popover inside a modal closes only the popover: the modal stays open
   + Escape inside the panel of a popover inside a modal closes only the popover: the modal stays open
   + a second Escape closes the modal around the popover
   + a manual popover open inside a modal lets Escape close the modal

combobox.test.ts
└─ Keyboard Behavior
   └─ listbox open / close
      + Escape in a combobox inside a modal closes only the listbox: the modal stays open
      + a second Escape closes the modal around the combobox

dropdown.test.ts
└─ Keyboard Behavior
   └─ dropdown open / close
      + Escape on an item of a dropdown inside a modal closes only the menu: the modal stays open
      + Escape on the trigger of an open dropdown inside a modal closes only the menu
      + a second Escape closes the modal around the dropdown

tooltip.test.ts
└─ Keyboard Behavior
   ✓ GIVEN an open tooltip WHEN focusing on the trigger and pressing the 'Escape' key THEN the tooltip should close
   + Escape on the trigger of a tooltip inside a modal closes only the tooltip: the modal stays open
   + Escape while a hovered tooltip shows inside a modal closes only the tooltip: the modal stays open
   + a second Escape closes the modal around the tooltip

@changeset-bot

changeset-bot Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5a7705a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@qwik-ui/headless Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/qwik-ui@1258
npm i https://pkg.pr.new/@qwik-ui/headless@1258
npm i https://pkg.pr.new/@qwik-ui/styled@1258
npm i https://pkg.pr.new/@qwik-ui/utils@1258

commit: 5a7705a

@maiieul
maiieul marked this pull request as ready for review November 29, 2026 18:07
@maiieul maiieul changed the title fix(popover, combobox, dropdown): keep Escape from closing the Modal around them fix(popover, combobox, dropdown, tooltip): keep Escape from closing the Modal around them Nov 29, 2026
@maiieul
maiieul merged commit 66d11c3 into qwikifiers:main Nov 29, 2026
6 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐞] Popover, Combobox, Dropdown, Tooltip: Escape inside a Modal also closes the Modal

1 participant