fix: Ensure document level mousedown listener is last#668
Merged
ConradJChan merged 6 commits intobox:masterfrom Jan 15, 2021
Merged
fix: Ensure document level mousedown listener is last#668ConradJChan merged 6 commits intobox:masterfrom
ConradJChan merged 6 commits intobox:masterfrom
Conversation
6f2cff7 to
2a19ae8
Compare
jstoffan
reviewed
Jan 14, 2021
src/common/MouseeventManager.tsx
Outdated
| store: Store; | ||
| }; | ||
|
|
||
| export default class MouseeventManager extends BaseManager { |
Collaborator
There was a problem hiding this comment.
Do we need a whole manager for this or can we follow the HighlightListener convention?
Contributor
Author
There was a problem hiding this comment.
I tried to go with the HighlightListener convention first, but it kind of needs the BaseManager logic of inserting a div to mount the react component so I ended up duplicating most of the BaseManager
2a19ae8 to
d6f2819
Compare
jstoffan
reviewed
Jan 15, 2021
jstoffan
reviewed
Jan 15, 2021
jstoffan
reviewed
Jan 15, 2021
jstoffan
reviewed
Jan 15, 2021
cc56bd4 to
a2fb242
Compare
mingzexiao6
previously approved these changes
Jan 15, 2021
mingzexiao6
approved these changes
Jan 15, 2021
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.
Issue
With the logic added to
BaseAnnotatortosetActiveIdtonullwhenmousedownevent is encountered this introduced a regression where if you click on the same annotation a second time, the annotation would no longer become activeSolution
Due to the way React handles events, an event listener added to
documentbefore the React code mounts will always be invoked first. The approach here is to attach the event listener todocumentafter the React code mounts, or more accurately, after the React code that matters mounts, i.e.*Listcomponents that havemousedownlogic, in order to take advantage of being able to prevent event propagation when appropriate.TODO: