Skip to content

feat(highlightlistener): Avoid get selection race#566

Merged
ConradJChan merged 1 commit intobox:masterfrom
ConradJChan:avoid-selection-race
Aug 28, 2020
Merged

feat(highlightlistener): Avoid get selection race#566
ConradJChan merged 1 commit intobox:masterfrom
ConradJChan:avoid-selection-race

Conversation

@ConradJChan
Copy link
Contributor

If you make a quick text selection, you sometimes find that the text selection goes beyond the text. This could also cause a slight shift in the highlight promoter popup after the selection is finished

What happens is that isMouseSelecting is set to false on mouseup but delays getting the text selection by 300ms -- meanwhile the debounced selectionchange event fires after 500ms and since isMouseSelecting is already set to false, it proceeds to grab the text selection before PDFJS has time to finish the enhanced text layer work.

@ConradJChan ConradJChan requested a review from a team as a code owner August 28, 2020 04:37
Copy link
Contributor

@mingzexiao6 mingzexiao6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@ConradJChan ConradJChan merged commit 4f3a718 into box:master Aug 28, 2020
@ConradJChan ConradJChan deleted the avoid-selection-race branch August 28, 2020 04:48
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.

2 participants