As the title states: Will focus still be set on form controls with autofocus="autofocus" even if they are hidden with display: none; or visibility: hidden;?
As the title states: Will focus still be set on form controls with autofocus=autofocus
Share
If your question is whether a hidden field can steal autofocus from a visible one, the answer is no.
Hidden fields with an
autofocusproperty get focus when they are made visible.Here’s a jsFiddle that shows what happens if you have a visible field and a hidden field, then show the hidden field.
And here’s a variation that demonstrates what happens if the visible field does not have an
autofocusproperty.