slate
slate copied to clipboard
Inline void selection and cursor placement issues on iOS
Description There are a few issues with selection and moving the cursor in/around inline void elements on iOS (tested both Chrome and Safari).
-
When selecting text then adjusting your selection with the blue selection pips:
- Starting with selection before inline void and expanded past works as expected
- Starting with selection after inline void and expanding backwards over the inline causes the selection to disappear
-
When scrubbing cursor placement by holding space bar:
- Scrubbing through an inline void element has very inconsistent behavior. Generally the cursor disappears, continuing to scrub around may sometimes escape or start a random selection.
Both of these behaviors seemed to work decently well and as expected on Android (using Chrome).
Recording
- Showing working going forward, then broken going backward:
https://user-images.githubusercontent.com/28637598/231021837-8b5df989-ab51-4249-b762-9627b925e2a4.mp4
- Showing inconsistent behavior:
https://user-images.githubusercontent.com/28637598/231022006-a03fa4c3-23fe-4749-b546-41400de1f3ba.mp4
Working (mostly anyway -- cursor scrubbing is very smooth, moving selection is less so but still functional) on Android:
https://user-images.githubusercontent.com/28637598/231023337-f41d3603-a2b0-46d6-b2e5-63ec454f8995.mp4
Sandbox This can be reproduced using the current live mention example: https://www.slatejs.org/examples/mentions
Steps To reproduce the behavior:
- Go to mention example on iOS
- Click on some text after a mention to begin a selection
- Drag the beginning of the selection backwards over the mention
- See selection disappear
Expectation The iOS selection behavior should be consistent with the Android behavior in the video above. Selections should seamlessly go across inline void elements. Additionally, scrubbing the cursor across should not get stuck and should not start selections.
Environment
- Slate Version: 0.93
- Operating System: iOS
- Browser: Chrome, Safari
It seems like this is an iOS bug as I can reproduce with the following plain html:
<body>
<div contenteditable>
hello world <span contenteditable="false">@username</span> this is a test!
</div>
</body>
Would love to hear if anyone has any workarounds for this issue or if there is a known upstream bug tracking this behavior.