fix(web-components): keep popover open after drag outside - #4616
fix(web-components): keep popover open after drag outside#4616sylvesterkaczmarek wants to merge 2 commits into
Conversation
|
Hi @sylvesterkaczmarek thank you for your recent contributions, however we have limited capacity to review them. Please refrain from contributing further until your existing PRs have been resolved |
0795646 to
e3b71bd
Compare
|
@GCHQ-Developer-299 Thanks for the heads-up, completely understood. I’ll pause any new contributions until the current PRs are resolved. I’ve only tidied this existing PR in the meantime: it’s now rebased on the current Happy to address any review feedback when convenient, and no rush from my side. |
| const MENU_ITEM_SELECTOR = "ic-menu-item"; | ||
| const POPOVER_SELECTOR = "ic-popover-menu"; | ||
|
|
||
| describe("IcPopoverMenu drag interactions", () => { |
There was a problem hiding this comment.
Please would you be able to add this test to the IcPopoverMenu.cy.tsx file instead of in its own test file?
e3b71bd to
1b185ad
Compare
|
Thanks for flagging this. I've replaced the failing Cypress interaction with a deterministic event sequence, addressed the destructuring comment, and cleaned the branch back to two scoped commits. The new Actions runs are now waiting for maintainer approval. |
923f9cd to
a8b47fb
Compare
|
@sylvesterkaczmarek further to my previous comment: I have bulk closed a number of your recent pull requests since you did not refrain from opening more. If you open another PR before we have resolved some of your existing pull requests I will block you from the UI Kit and Design System repositories. Whether you're an AI Agent or partly human operated, this torrent of contributions is unmanageable. |
|
Please rebase this branch |
@GCHQ-Developer-530 Rebased onto current develop. I also moved the drag-outside regression into IcPopoverMenu.cy.tsx as requested and cleaned the branch back to two scoped commits. Thanks a lot. |
There was a problem hiding this comment.
Pull request overview
This PR updates IcPopoverMenu to avoid dismissing the menu when a mouse interaction starts inside the popover menu and ends outside it (e.g., drag/text-selection), and adds a Cypress regression test to cover that scenario.
Changes:
- Track whether the current interaction started inside the popover menu and only close on outside click when it both starts and ends outside.
- Add a Cypress regression test for “drag starts inside, releases outside” to ensure the menu stays open and no item activates.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/web-components/src/components/ic-popover-menu/ic-popover-menu.tsx | Adds document mousedown tracking to distinguish outside clicks vs. drag-outside interactions before deciding to close. |
| packages/react/src/component-tests/IcPopoverMenu/IcPopoverMenu.cy.tsx | Adds Cypress regression coverage for drag-outside behavior and validates no item activation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @Listen("mousedown", { target: "document" }) | ||
| handleMouseDown(ev: Event): void { | ||
| this.pointerDownStartedInside = !this.isNotPopoverMenuEl(ev); | ||
| } |
| mount(<PopoverDropdown />); | ||
|
|
||
| cy.get("#popover-button").click(); | ||
| cy.get(POPOVER_SELECTOR).first().should("have.prop", "open", true); |

Summary of the changes
Prevent
IcPopoverMenufrom closing when a pointer interaction begins inside the menu and is released outside it.The document-level click handler now records where the corresponding mouse interaction started. A normal click outside still closes the popover, while a drag or text-selection gesture that starts inside does not dismiss the menu or activate an item.
A Cypress regression covers the drag-outside interaction.
Related issue
Closes #4476