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

Spinbutton: What should aria-valuenow be when a user gives invalid input, when should it update? #704

Closed
0ddfell0w opened this issue Jun 5, 2018 · 7 comments
Labels
Feedback Issue raised by or for collecting input from people outside APG task force Pattern Page Related to a page documenting a Pattern question Issue asking a question

Comments

@0ddfell0w
Copy link

We're developing an example ARIA spin button, and we're hoping for a clarification around aria-valuenow.

From the APG:

"The slider element has the aria-valuenow property set to a decimal value representing the current value of the slider."

What should the value of aria-valuenow should be when a user (for example) pastes in some invalid input. Should aria-valuenow simply not change? Should it be set back to some default when the spinbutton loses focus? Should the paste be undone by reverting to the previous value?

Thanks!

@0ddfell0w
Copy link
Author

Addendum: What should aria-valuenow be when the user deletes the text in the spinbutton? If it should be the empty string, can we adjust the following language to include a reference to that case?

"The spinbutton element has the aria-valuenow property set to a decimal value representing the current value of the spinbutton."

@jnurthen
Copy link
Member

jnurthen commented Jun 5, 2018

(this is not a WG response - just some additional information)

The native spinbutton in Firefox does not use valuenow but it does expose valuetext.
When an invalid value is specified valuetext is set to ""
When the value is deleted from the spinbutton valuetext also gets set to ""

IMO I would envision valuenow working in the same way to mozilla's valuetext implementation.

@0ddfell0w
Copy link
Author

Firefox also adds an invalid state when the input has either

  • a non-numerical value
  • a value outside of the range specified by min and max.

Chrome also adds an invalid state when the value is outside the range. However, Chrome does more to prevent non-numerical input. The input filters out the non-numerical characters and writes the numerical characters (including hyphens, periods, and even the letter e for scientific notation)

Would the WG consider adding instructions to set aria-invalid on spinbuttons when the value is invalid, either because it's nonsense or because it's outside of the specified range?

@mcking65 mcking65 added question Issue asking a question Feedback Issue raised by or for collecting input from people outside APG task force Pattern Page Related to a page documenting a Pattern labels Jul 20, 2018
@mcking65 mcking65 added this to the 1.1 APG Release 3 milestone Jul 20, 2018
mcking65 added a commit that referenced this issue Aug 6, 2018
…owed range

In response to issue #704, modified the roles, states, and properties section of the spinbutton pattern in aria-practices.html.

Added a bullet to the list of roles, states, and properties stating that aria-invalid is set true if it is possible for the textbox to contain a value that is not allowed.
@mcking65
Copy link
Contributor

mcking65 commented Aug 6, 2018

@0ddfell0w, The APG TF discussed this in today's teleconference.

The aria-valuenow, and if used, aria-valuetext, attribute should represent the current state of the control. That is, whatever is displayed should be reflected by the aria value attributes even if the displayed value is invalid. If the displayed value is invalid, then aria-invalid should be set.

Note that some spinbuttons are implemented so that inputting invalid values is not possible. For instance, numeric inputs will not allow letters to be typed.

So, the answers to your questions:

  1. What should the value of aria-valuenow be when a user provides invalid input? Should aria-valuenow not change? Should it be set back to some default when the spinbutton loses focus? Should the input be undone by reverting to the previous value?

The aria-value-now should be set to whatever value is displayed in the spinbutton, regardless of its validity.

  1. What should aria-valuenow be when the user deletes the text in the spinbutton?

Good question. I would say empty based on our discussion, but a closer look at the spec reveals that an empty value is not allowed for a required property, and aria-valuenow is required on spinbutton. The simplest solution is to change the spinbutton role so that aria-valuenow is supported rather than required. To address this possibility, I have raised w3c/aria#797.

  1. Would the WG consider adding instructions to set aria-invalid on spinbuttons when the value is invalid, either because it's nonsense or because it's outside of the specified range?

Yes, I've proposed such a change in pull request #825.

mcking65 added a commit that referenced this issue Aug 7, 2018
For issue #704, per feedback from @0ddfell0w, changed wording of guidance.
@jongund
Copy link
Contributor

jongund commented Aug 7, 2018

Maybe we are making this more complicated than it needs to be.
The reason designers use spin buttons is to avoid user input errors and therefore do not allow text input, they constrain user input by allowing them to only Increase and Decrease values. So a typical spin button does not allow text input or any invalid values since users can only increase or decrease the value of the control. So suggest our examples should only support increasing and decreasing values, no paste or text input operations.

Jon

@mcking65
Copy link
Contributor

mcking65 commented Aug 7, 2018

@jongund, sliders have those limitations. Spinbuttons do not.

I agree that an example that is the simplest possible could be helpful. But, at least in my experience, there is more variety than that. I have frequently encountered spinners that accept text input. Some are better than others at limiting input.

Regardless, the APG needs to answer the questions that are not obvious from the spec ... in this case, we have several that need answers.

@w3c w3c deleted a comment from jongund Aug 13, 2018
mcking65 added a commit that referenced this issue Aug 29, 2018
…owed range (pull #825)

In response to issue #704, modified the roles, states, and properties section of the spin button pattern in aria-practices.html.

Added a bullet to the list of roles, states, and properties stating that aria-invalid is set true if it is possible for the textbox to contain a value that is not allowed.
michael-n-cooper pushed a commit that referenced this issue Aug 29, 2018
Spin Button Pattern: Add aria-invalid guidance for values outside allowed range (pull #825)

In response to issue #704, modified the roles, states, and properties section of the spin button pattern in aria-practices.html.

Added a bullet to the list of roles, states, and properties stating that aria-invalid is set true if it is possible for the textbox to contain a value that is not allowed.
@mcking65
Copy link
Contributor

This issue was resolved with the merge of pull request #825 yielding commit 4992388.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feedback Issue raised by or for collecting input from people outside APG task force Pattern Page Related to a page documenting a Pattern question Issue asking a question
Development

No branches or pull requests

4 participants