Sendkeys to focussed element should not reset carat position
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 718
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Description
There was some discussion on the selenium repository https://github.com/SeleniumHQ/selenium/issues/7330 about the spec specifying
- Let current text length be the JavaScript string’s length of element’s API value.
- Set the text insertion caret using set selection range using current text length for both the start and end parameters.
This will stop a scenario where a use attempts to modify the carat position from working correctly such as
- SendKeys "abc"
- SendKeys left arrow 3 times
- Sendkeys "123"
the carat repositioning would be removed.
Based on the selenium thread, it seems like Firefox already does not reset the caret position if the field is in focus.
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
Start with the linked Selenium discussion and the sendkeys sequence described in this issue, then locate the WebDriver specification section defining text insertion and caret placement. Update the specification so sending keys to an already focused element preserves its caret position, and verify that the described abc, left-arrow, 123 scenario matches the clarified behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100