Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autofocus attribute must not be specified in <input> element whose type attribute is in the Hidden state #4578

Closed
mtrootyy opened this issue Apr 27, 2019 · 4 comments

Comments

@mtrootyy
Copy link

https://html.spec.whatwg.org/multipage/input.html#hidden-state-(type=hidden)

Bookkeeping details

  • The autocomplete content attribute applies to this element.
  • The value IDL attribute applies to this element and is in mode default.
  • The following content attributes must not be specified and do not apply to the element: accept, alt, ......
  • The following IDL attributes and methods do not apply to the element: checked, files, ......
  • The input and change events do not apply.

 ↓

The above should be fixed following:

Bookkeeping details

  • The autocomplete content attribute applies to this element.
  • The element's autofocus attribute must not be specified.
  • The value IDL attribute applies to this element and is in mode default.
  • The following content attributes must not be specified and do not apply to the element: accept, alt, ......
  • The following IDL attributes and methods do not apply to the element: checked, files, ......
  • The input and change events do not apply.

 
Because it is impossible to focus on input element whose type attribute is in the Hidden state.

@annevk
Copy link
Member

annevk commented Apr 30, 2019

Does it apply in user agents? If not, shouldn't we add it to the list of content attributes that must not be specified and do not apply?

@domenic
Copy link
Member

domenic commented Aug 1, 2019

It's unclear why we would add this, to me. An input type=hidden could become type=text at a later time, in which case specifying autofocus could be useful.

In other words, I don't think we currently try to prohibit specifying autofocus on hidden elements in general (e.g. <input type=text hidden>), or disabled elements, or similar. I wouldn't want to special case input type=hidden.

@annevk
Copy link
Member

annevk commented Aug 21, 2019

But autofocus only takes effect during insertion, not when a type attribute of an input element changes. There might well be a larger issue though.

@domenic
Copy link
Member

domenic commented Aug 21, 2019

Given #4830, I think it's best to close this.

@domenic domenic closed this as completed Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants