-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#172 Added popup hiding when the annotation's target is actively updated #174
Open
oleksandr-danylchenko
wants to merge
13
commits into
recogito:main
Choose a base branch
from
oleksandr-danylchenko:#172-fix-popup-flickering-selection
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
#172 Added popup hiding when the annotation's target is actively updated #174
oleksandr-danylchenko
wants to merge
13
commits into
recogito:main
from
oleksandr-danylchenko:#172-fix-popup-flickering-selection
Conversation
This file contains 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
This reverts commit 16a3660.
# Conflicts: # packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.tsx # packages/text-annotator-react/test/App.tsx
*The changes in this PR passed the QC on our side and the user can no longer react to the popup during the selection ✔️ idle_popup.mp4 |
oleksandr-danylchenko
force-pushed
the
#172-fix-popup-flickering-selection
branch
4 times, most recently
from
November 18, 2024 13:05
f8f7604
to
7f7aa5b
Compare
oleksandr-danylchenko
force-pushed
the
#172-fix-popup-flickering-selection
branch
from
November 18, 2024 13:28
7f7aa5b
to
40fb398
Compare
Comment on lines
+58
to
+66
const hasTargetQuoteChanged = (oldValue: TextAnnotationTarget, newValue: TextAnnotationTarget) => { | ||
const { selector: oldSelector } = oldValue; | ||
const oldQuotes = oldSelector.map(({ quote }) => quote); | ||
|
||
const { selector: newSelector } = newValue; | ||
const newQuotes = newSelector.map(({ quote }) => quote); | ||
|
||
return !dequal(oldQuotes, newQuotes); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inspired by the A9S's hasTargetChange
method, source
# Conflicts: # package-lock.json # packages/text-annotator-react/package.json # packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.tsx
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 - #172
That's because the selection can accidentally go over the popup element that's portalled out of the annotatable content container at the bottom. So the selection just glues to its edge for a moment.
Changes Made
I added an idling listener that renders the popup only when there are no updates to the annotation's
target
for some time. The "update" is recognized when thequote
updates. Otherwise, the popup shouldn't be concerned about the updates for the rest of the properties.That prevents an accidental overlap with the user's touch and repositioning on the selection correction over the whitespace.
I also tried another alternative - making the popup act like the native context menu. However, its tracking turned out to be super unreliable and complex. So I retreated to a more pragmatic option.