Skip to content
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

Prevent model selection synchronizing to DOMSelection during selection. #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cuppi
Copy link

@cuppi cuppi commented Feb 15, 2023

Current behavior: Now there are some selection issues that are bothering me, e.g.
A NodeView with margin(margin-left and margin-right), when select from NodeView's right to left, the selection is collapsed accidentally.
1

A NodeView that regardless of margin, when select from NodeView's right to left, and shuffling between text and NodeView, the anchor of the selection was be collapse to NodeView left.
1

A NodeView that has content in the schema but does not set with contentDOM, when select from NodeView's right to left, and shuffling between text and NodeView, the anchor of the selection was be collapse to NodeView left.
1

Expected behavior: The selection should not be affected by the element style and "anchor" should be fixed while moving the "focus"

Through some experiments, I found that when I set the selection in the selectionChange callback triggered by mouse interaction, when the set selection is not the "legal" position considered by the browser, the browser may readjust the selection. Therefore, I boldly submitted a PR - In the callback of selectionChange triggered by mouse interaction, do not synchronize selection from model to DOM. I think there might be some unexpected effects, so I'm looking forward to your insight.

Demo to reproduce the issue: Glitch.

@marijnh
Copy link
Member

marijnh commented Apr 14, 2023

This is unlikely to be merged as-is, since indeed, it'll probably break some stuff. Could you set up a demo that allows me to reproduce the behavior in your screencasts? I assume this is Chrome, behaving like that?

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