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

The clear algorithm does not work for input elements in Range or Color state #1311

Open
JohnChen0 opened this issue Oct 3, 2018 · 3 comments

Comments

@JohnChen0
Copy link
Contributor

In chapter 14. Element Interaction:

set the value of the element to an empty string

The clear algorithm for input elements requires setting the value of the element to an empty string. However, this is not possible for input elements in Range or Color state. Both https://html.spec.whatwg.org/#range-state-(type=range) and https://html.spec.whatwg.org/#color-state-(type=color) specify that "User agents must not allow the user to set the value to the empty string."

For an input element in Range state, the clear algorithm should set its value to the default value, as given in the HTML spec. For input elements in Color state, the clear algorithm should set its value to "#000000".

@andreastt
Copy link
Member

HTML differentiates between a form control’s internal value, the value content attribute, and the value IDL attribute. These are three different concepts.

In this case WebDriver conflates the notion of value, but it actually means the IDL attribute. Setting the IDL attribute to an empty string will cause the constraint validation to set the internal value to the default value.

It would probably be wiser as you suggest to special-case <input type=color> and <input type=range> to use the default value.

@JohnChen0
Copy link
Contributor Author

Thanks for the clarification. It would be easier for people reading the standard if this is clarified in the standard itself.

@andreastt
Copy link
Member

Related change to the clear algorithm for <input> elements:
#1317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants