3 ms·
Autofocus works only on page load and not when the input is injected later by JS.
by Kuinox 3y ago
Autofocus works only on page load and not when the input is injected later by JS.
- xigoi 3y agoSo why not have the input be there on page load?
- Kuinox 3y agoBecause when you do reactive web pages, they are not necessarly here on page load. I made a JS file explorer, to see files on the server from the browser. I wanted to mimic the windows explorer breadcrumb path bar. If you look at the behavior of the breadcrumb pathbar, you can't do that on page load, you have to replace the breadcrumb by an input text on clic, so not at page load. Yes theroically, you can fetch a whole new page for that, but it would imply fetching a new page from the server just for this: it doesn't make sense.