Should selection start/end be limited to the size of the text?
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 48
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
While looking at #87 I noticed that updateSelection() as currently specified doesn't prevent the author from specifying a selection that's outside the bounds of the text.
This is not what I would have expected; it seems like a potential source of errors to allow selection to be set outside of the text. It's not exactly clear how the browser should handle adjusting selection in these scenarios.
We should consider enforcing that updateSelection() not allow the author to set a selection begin or end larger than the size of EditContext.text.
If we add this restriction, we'd also want to have updateText() adjust the selection offsets if the update would put them outside of the new shortened text.
The current Chromium implementation clamps the selection set in updateSelection() to the length of the text, but does not throw an error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the EditContext specification sections defining updateSelection() and updateText(), then compare their intended behavior with the current Chromium implementation described in the issue. Done means the specification clearly resolves out-of-bounds selection handling and defines how shortened text affects selection offsets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- api, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100