Automattic / Automattic/harper
Cursor/caret jumps after doing a lint edit - to the start for `textarea` and end for `contenteditable`
- Dominant language
- Rust
- Stars
- 15.4k
- Forks
- 627
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 106
Description
**Describe the bug**
The cursor jumps to the beginning of a `contenteditable` `div` after choosing a correction from the Harper popup.
And it jumps to the end of a `textarea`.
This is with my Harper Glasses extension on Chrome, but it's pretty minimal and dumb, just creating its own HTML element in a popup and letting Harper do its thing there, so it should have the same behaviour as in a regular web page.
This seems to happen even if I specifically moved the cursor/caret before doing a correction. If I haven't put it anywhere it probably matters less but maybe in that case it should move to the end of the edit it just made?
Contributor guide
Research direction
No file or test is named in the report. First reproduce the Harper popup correction flow in Chrome with both a textarea and a contenteditable div, then trace the browser-facing cursor and selection handling; done means the caret no longer jumps to the wrong boundary and preserves a manually placed caret.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100