search widget autofocus does not work on Firefox
- Dominant language
- Go
- Stars
- 37.1k
- Forks
- 1.5k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 1
Description
### Description
When I have a search widget set up like this:
```yaml
- type: search
search-engine: duckduckgo
autofocus: true
```
It does not autofocus the search bar only on Firefox, the autofocus attribute does correctly appear on the element however.
I think this has something to do with Firefox not respecting the autofocus attribute when the element is not present on the original page load. Since the search bar appears a short time after the DOM first loads, Firefox ignores it.
I was able to solve this for myself by adding the following widget below the search widget:
```yaml
- type: html
source: |
document.getElementsByClassName('search-input')[0].focus();
```
At the very least this quirk should be mentioned in the documentation so others don't have to look far for a solution.
Edit:
My solution only sometimes works. I haven't been able to figure out what causes it to fail yet.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.