-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix selection over on MathJax interaction #15
Conversation
We noticed that for MathJax only interaction it could cause issue as the `trimLeft/Right` function gets into infinite loop (wow!). This is a fix for that. We also ensure that the space around the text is displayed properly, that give some indication of selection.
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.
Ahh interesting fix. Small request: can testing steps include which browsers you tested this on?
currentRange.startContainer !== lastContainer && | ||
(!isTextNode(currentRange.startContainer) || isSpace(currentRange.startContainer.textContent[currentRange.startOffset])) | ||
); |
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.
Could use a brief comment.
LOL - am just testing on Firefix as I see this review :) shall do! |
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.
Thanks!
…9e1b75f9126f01cbcf1a6f27c22105422384 at Khan/label-studio-frontend#15 Workflow run: https://github.com/Khan/label-studio/actions/runs/10206309931
Summary:
We noticed that for MathJax only interaction it could cause issue
as the
trimLeft/Right
function gets into infinite loop (wow!).This might be the contribution of some of the slowness issue we see.
This is a fix for that. We also ensure that the space around the
text is displayed properly, that give some indication of selection.
I also took a look at the upstream, but did not notice any relevant fixes
that is related.
Issue: https://khanacademy.atlassian.net/browse/DI-1513
Test plan:
Run
yarn start
Selecting on the "Pure mathjax" interaction will show this issue without the fix.
Tested on: