aria icon indicating copy to clipboard operation
aria copied to clipboard

Consider creation of a fieldsize/maxlength property

Open joanmarie opened this issue 5 years ago • 8 comments

HTML has a maxlength property on text and textarea. This property currently controls how many characters can be input. For instance, a PIN field limited to 4 characters.

At the present time, this is not mapped on any platform, but I can imagine a screen reader user wanting to know that a field only accepts 4 characters. This information tends to be obvious to sighted users (input stops going into the field), but might not be to users who are blind.

joanmarie avatar Nov 14 '19 18:11 joanmarie

@jnurthen This came up today internally. What's the timeline for 1.4?

benbeaudry avatar May 18 '23 16:05 benbeaudry

We are seeing this used more and more. The current guidance is to be exposing character count information through live regions which is an oversized hammer. This seems easily mapped into platform APIs along with the current count. This information would allow screen readers to expose the information best for their users. I have discussed with NV Access and Vispero and they are onboard with mapping these to existing IA2/UIA properties.

douggeoffray avatar Aug 18 '23 19:08 douggeoffray

The UIA mapping would be the RangeValue control pattern: https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-implementingrangevalue

The IA2 mapping appears to be the IAccessibleValue::maximumValue pattern, though external confirmation would be good: https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/interface_i_accessible_value.html#a55e179b8a504a0c44049f6d4edd0bc79

ATK looks like atk_value_get_range: https://gnome.pages.gitlab.gnome.org/atk/AtkValue.html#atk-value-get-range (@joanmarie, does that look right?)

[Edited by James] I found maxValue but @cookiecrook confirmed that's for range values, not maxlength. https://developer.apple.com/documentation/appkit/nsaccessibility/attribute/1525668-maxvalue

smhigley avatar Nov 16 '23 19:11 smhigley

@smhigley The ATK/AT-SPI2 value interface is intended for numeric ranges (progress bars, spin buttons, sliders, etc., etc.). For instance, in the case of a spin button that lets you select a numeric month, the range is 1 (min) - 12 (max). The maxlength would be 2. (Right?)

I'm afraid that for specifying the maximum number of characters which can be input in a text input, there's not any good API for that. So the mapping should be.... wait for it.... yet another object attribute. :grinning:

Thanks for checking and please let me know if you have any questions.

joanmarie avatar Nov 16 '23 20:11 joanmarie

Discussion topics/summary: https://gist.github.com/smhigley/45783c28b47ef46818a4aaed3879528f

smhigley avatar Mar 28 '24 16:03 smhigley

Plan going forward:

  1. Map html maxlength to metadata on chars remaining
  2. create aria-remaining-style attr to map chars remaining (including negative values)
  3. check with AT vendors on if they like the idea, and if they could use existing events to do useful things (e.g. bonks) with it

related: VO bonking bugzilla issue: https://bugs.webkit.org/show_bug.cgi?id=271831

smhigley avatar Mar 28 '24 17:03 smhigley

Minutes from today https://www.w3.org/2024/03/28-aria-dive-minutes.html

jnurthen avatar Mar 28 '24 18:03 jnurthen

a topic that came up today is supporting instances of where a text field needs to convey the max length, but also might allow people to type over that length (e.g., twitter allows one to type whatever they want, but if you are beyond the max length then the tweet wont be allowed to publish)

scottaohara avatar May 14 '24 20:05 scottaohara