Repository navigation
Conversation
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.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3077
Every time Block Tunes or the Inline Toolbar was opened and closed, one
keydownlistener stayed ondocument.Flipper.activate()adds the listener in the capture phase, butFlipper.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.tsopens and closes Block Tunes three times and counts the capturekeydownlisteners ondocument. Onnextit stops after the first close with 1 listener left.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()andToolbox.destroy()do not close it. That is separate code, so I can send it as another PR.