-
Notifications
You must be signed in to change notification settings - Fork 6
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
Selecting on touch devices causes highlight flickering when move down rapidly #172
Comments
Yes, I saw this, too. But haven't investigated further yet. The selection clearly breaks as it goes from the selection start (on the text) to somewhere on the portal popup. I believe the popup is already marked as |
Thanks!! Hm, seems like the selection goes to the popup, which itself is not annotatable. Therefore, the clipping will select up to the popup which, because the popup is portalled, is the end of the page? |
I suppose that's one of the reasons behind hiding the native content menu popup when the selection is active. It doesn't allow the case when the selection goes "over" the floating element. |
It seems to be a common issue in the annotating solutions though 😅 slab_jump_up_little.mp4slab_jump_up_screen.mp4 |
I also tried putting the |
Putting the portal at the top rather than the end sounds. But yikes for the scroll behavior... That seems actually worse UX than the jumping selection I believe.
Ouch. The selection still happens even if the popup has |
Maybe we can refer to such a strategy too? As, technically speaking, we can know when the selection is "active" and when it "pauses" on The "idling" concept would also be beneficial to the |
Agreed - sounds sensible. |
I tried adding the following simple hook for tracking the idling on a single annotation: const useAnnotationTargetIdling = (
annotationId: string | undefined,
options: { timeout: number } = { timeout: 500 }
) => {
const store = useAnnotationStore();
const [isIdling, setIdling] = useState(true);
useEffect(() => {
if (!annotationId) return;
let idlingTimeout: ReturnType<typeof setTimeout>;
const scheduleSetIdling = () => {
setIdling(false);
clearTimeout(idlingTimeout);
idlingTimeout = setTimeout(() => setIdling(true), options.timeout);
};
store.observe(
scheduleSetIdling,
{
annotations: annotationId,
ignore: Ignore.BODY_ONLY,
origin: Origin.LOCAL
}
);
return () => {
clearTimeout(idlingTimeout);
store.unobserve(scheduleSetIdling);
};
}, [annotationId]);
return isIdling;
}; It works pretty nice for the cases when I do a continuous selection and then release the finger. It accounts for the time needed for the selector to adjust the range to the whitespace. Record_2024-11-06-16-47-59.mp4That's caused by another reported issue - #169. The store reports about the |
…ng-testing # Conflicts: # packages/text-annotator-react/src/TextAnnotatorPopup/TextAnnotatorPopup.tsx # packages/text-annotator-react/src/hooks/index.ts # packages/text-annotator/src/SelectionHandler.ts
# Conflicts: # packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.tsx # packages/text-annotator-react/test/App.tsx
# Conflicts: # packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.tsx
# Conflicts: # package-lock.json # packages/text-annotator-react/package.json # packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.tsx # packages/text-annotator-react/src/hooks/index.ts
# Conflicts: # packages/text-annotator-react/src/hooks/useAnnotationQuoteIdling.ts
# Conflicts: # package-lock.json # packages/text-annotator-react/package.json # packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.tsx
…ng-merge-candidate
Issue
I noticed that when the
TextAnnotatorPopup
is rendered and I move select text down rapidly - the finger can go over the floating element and cause the highlight flickering:Record_2024-11-04-15-32-39.mp4
However, it doesn't happen when I remove the popup rendering:
Record_2024-11-04-15-33-33.mp4
In the real app on iOS it looks even more flickery when the selection goes over the headings:
iOS_flickering.mp4
The text was updated successfully, but these errors were encountered: