Skip to content

fix(flipper): remove the keydown listener when a popover is closed - #3081

Open
og-orca wants to merge 1 commit into
codex-team:nextfrom
og-orca:fix/flipper-keydown-leak
Open

og-orca wants to merge 1 commit into
codex-team:nextfrom
og-orca:fix/flipper-keydown-leak

Conversation

@og-orca

@og-orca og-orca commented Dec 2, 2026

Copy link
Copy Markdown

Fixes #3077

Every time Block Tunes or the Inline Toolbar was opened and closed, one keydown listener stayed on document.

Flipper.activate() adds the listener in the capture phase, but Flipper.deactivate() removed it without the capture flag. The browser treats those as two different listeners, so nothing was removed. deactivate() now passes the same flag.

The new test in flipper.cy.ts opens and closes Block Tunes three times and counts the capture keydown listeners on document. On next it stops after the first close with 1 listener left.

before and after

All 390 Cypress tests pass here in Electron. I did not run Firefox or Edge.

I left one case alone. A popover that is still open when the editor is destroyed keeps its listener, because BlockSettings.destroy() and Toolbox.destroy() do not close it. That is separate code, so I can send it as another PR.

The listener is added in the capture phase, so it has to be removed with the same flag. Otherwise it stays on the document after each open.
@og-orca
og-orca requested a review from neSpecc as a code owner December 2, 2026 17:46

This branch has not been deployed

No deployments
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.

Flipper leaks its document keydown listener: added with capture, removed without

1 participant