-
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
Annotation isn't dismissed clicking an empty space, covered by the native selection range ⚠️ #136
Comments
…nge-click' into staging # Conflicts: # packages/text-annotator/src/SelectionHandler.ts
…nge-click' into keyboard-event-selection # Conflicts: # packages/text-annotator/src/SelectionHandler.ts
…n-native-range-click # Conflicts: # packages/text-annotator/src/SelectionHandler.ts
…nge-click' into keyboard-event-selection # Conflicts: # packages/text-annotator/src/SelectionHandler.ts
…n-native-range-click # Conflicts: # packages/text-annotator/src/SelectionHandler.ts
…nge-click' into keyboard-event-selection # Conflicts: # packages/text-annotator/src/SelectionHandler.ts
…nge-click' into staging # Conflicts: # packages/text-annotator/src/SelectionHandler.ts
…sssed-annotation-on-native-range-click #136 Fixed missing annotation dismissal clicking over native selection range
Just adding that this should now also work in the revised-selection-behavior branch. |
Hello @rsimon 👋🏻 That creates a weird effect that makes a user tap twice to dismiss the selection. Similar to the one we had in the demos above ;( |
Incredibly... increasing the |
Background
While handling the
pointerup
event, checking thedocument.getSelection().isCollapsed
property can behave in 2 ways:isCollapsed
isfalse
even though the native highlight disappears!isCollapsed
is expectedlytrue
, matching the native highlight disappearance.Screen.Recording.2024-08-14.at.16.16.35.mov
Issue
In the
SelectionHander
the annotation selection gets dismissed only when thepointerdown
+pointerup
combination is recognized as the "click" and there's nothing "hovered" (lines 152-155 & 144-146):text-annotator-js/packages/text-annotator/src/SelectionHandler.ts
Lines 149 to 157 in e6d3f33
text-annotator-js/packages/text-annotator/src/SelectionHandler.ts
Lines 134 to 147 in e6d3f33
However, as the
document.getSelection().isCollapsed
isfalse
when you click over the native selection range, the annotation selection sometimes doesn't get dismissed!Instead, the annotation gets selected another time, because the
currentTarget
is still present!Alternatively, we expect that the annotation selection will behave like the native selection highlight in all cases. When you click on an empty space - it should be dismissed.
Issue Examples
Screen.Recording.2024-08-14.at.16.37.28.mov
annotation_dismissed.mp4
Suggested Changes
The root of the issue is the
document.getSelection().isCollapsed
that is "lagging behind" on thepointerup
event handling.After I added a 0ms. timeout for the reading, I started getting more adequate value consistently. It's always
true
either when you click on the selected range or some other content.Screen.Recording.2024-08-14.at.16.47.39.mov
In that way, the "click" will always get processed consistently and the annotation selection will get dismissed when you didn't click on the highlight explicitly.
The text was updated successfully, but these errors were encountered: