api.HTMLElement.focus - incompabile behaviour on input elements
Nobody has claimed this yet.
- Dominant language
- JSON
- Stars
- 5.8k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 186
Description
What type of issue is this?
Browser bug (a bug with a feature that may impact site compatibility)
What information was incorrect, unhelpful, or incomplete?
I've noticed that on WebKitGTK calling focus also selects the value of input elements. On Firefox, you're required to call focus and select.
What browsers does this problem apply to, if applicable?
Safari
What did you expect to see?
As per the spec, it seems that focus shouldn't select.
Did you test this? If so, how?
Tested on WebKitGTK and Firefox.
<input id="myTextField" value="Text field." />
<button id="focusButton">Click to set focus on the text field</button>
document.getElementById("focusButton").addEventListener("click", () => {
document.getElementById("myTextField").focus();
});
Can you link to any release notes, bugs, pull requests, or MDN pages related to this?
No response
Do you have anything more you want to share?
No response
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
MDN metadata
MDN page report details
- Query:
api.HTMLElement.focus - Report started: 2025-02-16T17:49:19.301Z
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 api.HTMLElement.focus entry and the linked MDN page, then reproduce the provided HTML and JavaScript in WebKitGTK and Firefox. Compare the observed selection behavior with the linked HTML specification and existing compatibility data; done means the behavior is verified and the appropriate compatibility record is corrected or confirmed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100