siblingpastry,
@siblingpastry@mastodon.world avatar

Writing up some best-practice patterns for form controls, and I've assembled this list of native HTML controls that should never be used (because they're not universally supported, and/or their native UI has accessibility problems):

<input type="color">
<input type="date">
<input type="datetime">
<input type="datetime-local">
<input type="number">
<input type="time">
<input type="week">

Any debate on those? Anything I've missed?

aardrian,
@aardrian@toot.cafe avatar

@siblingpastry &lt;select multiple&gt;, &lt;select size&gt;

Not about support, but about how users do not grok them.

siblingpastry,
@siblingpastry@mastodon.world avatar

@aardrian That's a useful point too, thanks. Those use-cases are well covered by radio and checkbox groups anyway.

aardrian,
@aardrian@toot.cafe avatar

@siblingpastry Exactly. Typically better covered by those controls.

siblingpastry,
@siblingpastry@mastodon.world avatar

@aardrian Are you aware of any issues with these ones:

<input type="email">
<input type="tel">
<input type="url">

They don't seem to do anything different from "text", except for built-in validation constraints, and in some cases input mode (though that's not universally reliable without an explicit inputmode attribute).

aardrian,
@aardrian@toot.cafe avatar

@siblingpastry I am not.

And &lt;input type="search"&gt; was also harmless:
https://adrianroselli.com/2019/07/ignore-typesearch.html

siblingpastry,
@siblingpastry@mastodon.world avatar

@aardrian Now I'm just waiting for the revision to say "mostly harmless". 🌍

Myndex,
@Myndex@techhub.social avatar

@siblingpastry

Yea I pretty much hate every date/calender input out there, and most of the color input tools too.

Interestingly, I think most color choosing tools and date choosing tools fail for the same reason: a “nearly infinite” set of possible choices.

Consider a date tool. Do you need to enter a date for next week for an appointment? Or a date/time in a month for a holiday trip, but you have to schedule around two other people.

Or, enter your birthday.

Or, find that event that was ten years ago, but it might have been 9 or 11 years, and you’re in California where we don’t have seasons so you can’t remember time of year…

That’s four different task requirements, and a simple all purpose tool is not an ideal solution.

But “simple all purpose” is what most UIs for date/time are.

siblingpastry,
@siblingpastry@mastodon.world avatar

@Myndex Those are all pertinent questions yeah. I'm in-progress developing an accessible datepicker, and that's gonna have to come with a lot of guidance on when and how to use it (eg. don't use it for birthdays).

Don't get me started on calculating week numbers ... jesus wept. Thankfully the Date() constructor does most of the work on out-of-range date values though.

patrick_h_lauke,
@patrick_h_lauke@mastodon.social avatar

@siblingpastry <input type="image"> mainly for the ... "why?" factor

siblingpastry,
@siblingpastry@mastodon.world avatar

@patrick_h_lauke Lol yeah I noted that -- you can use it, but it's completely pointless when we have <button>

joelanman,
@joelanman@hachyderm.io avatar

@siblingpastry related, html5 form validation, so add novalidate to form tags

siblingpastry, (edited )
@siblingpastry@mastodon.world avatar

@joelanman Ah yeah that's a separate article :-)

Right now I'm just dealing with declarative markup -- control types, labels, autocomplete and inputmode, that kinda stuff.

siblingpastry,
@siblingpastry@mastodon.world avatar

@joelanman Including the advice that form fields should never be declaratively disabled or read-only, only dynamically for data integrity (eg. disabling the submit button after the form is submitted to prevent accidental duplicate submission, but never disabling it in advance as a kind of validation).

Noting that screen readers generally don't notify the user at all when their typing produces no input, which kinda rules out read-only fields altogether, not to mention maxlength.

joelanman,
@joelanman@hachyderm.io avatar

@siblingpastry I think I read it's better after form submission to use javascript to preventDefault than disable, as disable affects focus

siblingpastry,
@siblingpastry@mastodon.world avatar

@joelanman Yeah I had that focus management issue in my mind too, but I was thinking -- it doesn't matter if focus is lost, since the page/view is about to be replaced anyway?

siblingpastry,
@siblingpastry@mastodon.world avatar

@joelanman This is worth a note though, thanks -- if submission won't update the view, then focus must be managed, or use preventDefault.

joelanman,
@joelanman@hachyderm.io avatar

@siblingpastry I think the issue is you don't know how long the response might take, so you might be able to interact with the page until then

siblingpastry,
@siblingpastry@mastodon.world avatar

@joelanman Ah good point yeah.

aardrian,
@aardrian@toot.cafe avatar

@siblingpastry @joelanman Agreed — do not make the button disabled because sometimes servers take longer than a femtosecond.

siblingpastry,
@siblingpastry@mastodon.world avatar

@aardrian @joelanman I'm gonna go with this advice:

Disabling the button will cause it to lose keyboard focus, which could be confusing or annoying for keyboard users, if the page is still usable while it’s waiting for a server response.

A better solution for cases like this is to block the form’s submit event:

form.addEventListener('submit', (e) =&gt; {  
 e.preventDefault();  
});  
aardrian,
@aardrian@toot.cafe avatar

@siblingpastry
I might move that sub-clause into its own following sentence, but yeah, that seems fine.

A visual change might be good to apply while the default is being prevented. A cue that the button is now ignoring the user (especially if the button otherwise has a visual change when activated).

@joelanman

siblingpastry,
@siblingpastry@mastodon.world avatar

@aardrian

Right yeah, it could be aria-disabled and visually dimmed, without being disabled

@joelanman

aardrian,
@aardrian@toot.cafe avatar

@siblingpastry
That. With [aria-disabled] as the CSS selector to help enforce programmatic alignment.

Anyway, I know you know all this. I just want to participate.

@joelanman

yatil,
@yatil@yatil.social avatar

@siblingpastry I think number is OK, if you really want a single number, like the amount of items in a shop. (But there might be something that I’m missing.)

siblingpastry,
@siblingpastry@mastodon.world avatar

I'm also unilaterally advising against <input type="reset"> because its utility is marginal, and far outweighed by its potential for data loss when users click it by mistake.

yatil,
@yatil@yatil.social avatar

@siblingpastry Yes. Your form should never lose information unless the user is actively navigating away from the page, and even then a confirmation does not hurt.

siblingpastry,
@siblingpastry@mastodon.world avatar

@yatil It's valid for incremental values yeah, but not for numerical-text values like CC numbers. But gov.uk encountered some issues with it, that are why I added it to the list -- https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/

yatil,
@yatil@yatil.social avatar

@siblingpastry Those are by definition not numbers 😉 I agree there is a lot of misconceptions around it and why I put it in the “beware” column, where I would put all others in the “do not use under any circumstances” column.

siblingpastry,
@siblingpastry@mastodon.world avatar

@yatil If it was just that misconception issue, then yeah. But the AT issues that their testing uncovered seemed like a much bigger deal.

These points are worth an explicit note in the article though, for sure.

yatil,
@yatil@yatil.social avatar

@siblingpastry Understandable. Looks like some of the AT issues have been addressed in the meantime, especially Dragon and Safari/VO seem to work better now: https://a11ysupport.io/tests/tech__html__input__input-number

siblingpastry,
@siblingpastry@mastodon.world avatar

@yatil I'm not clear on what the "not applicable" results mean in that context?

yatil,
@yatil@yatil.social avatar

@siblingpastry For VO/iOS there is no way to increment/decrement the value for anyone, so I guess that is meant by not applicable. I assume it’s a similar deal with Android/TB.

siblingpastry,
@siblingpastry@mastodon.world avatar

@yatil Oh I see, so it's not an issue with the AT. That makes sense in context, but then in practical end-user terms, it means not supported?

cwilcox808,
@cwilcox808@c.im avatar

@siblingpastry @yatil
It's fine if the "spinner" controls of a number input are an affordance only for pointer users, everyone can still enter digits into them.

My recollection is all the accessibility issues listed in the GDS article have since been addressed. All the Voice Control tests listed on a11ysupport are older than the GDS article so they might have also been corrected.

siblingpastry,
@siblingpastry@mastodon.world avatar

@cwilcox808 I’m not sure I’d relegate those buttons to just affordance, they’re functionality that should be supported directly or by equivalence. I’ll do some testing on Monday see what the current state of play is.

@yatil

yatil,
@yatil@yatil.social avatar

@siblingpastry @cwilcox808 Considering that the spinner buttons would need to be within the size of the input fields, which would make the touch target very small. On iPad, you can use keyboard up/down in the field to change the number. (I think all touch spin buttons like that are quite compromised.)

siblingpastry,
@siblingpastry@mastodon.world avatar

@yatil @cwilcox808 Interesting, so then that would tend towards just considering them superfluous. And they wouldn’t fail 2.5.8 even when author sized too small and close, because they do have equivalence.

yatil,
@yatil@yatil.social avatar

@siblingpastry @cwilcox808 The target’s size is determined by the user agent in that case, so it’s excepted. (But yeah, the main objective of the field is to enter a number, not really the incrementing/decrementing part.)

siblingpastry,
@siblingpastry@mastodon.world avatar

@yatil @cwilcox808 Only if the input isn’t author-sized, as soon as you set dimensions, that UA exception no longer applies. But equivalence would still pass it.

yatil,
@yatil@yatil.social avatar

@siblingpastry @cwilcox808 I don’t agree. The target in this case are the individual up/down buttons. Because the input type number has three targets: The input field and the up and down arrows. The exception applies to them individually. At least I would test it like that. (No power really to go deeper into this. The AG WG probably knows what they meant.)

siblingpastry,
@siblingpastry@mastodon.world avatar

@yatil Yeah they’re separate targets, but the size of the spin buttons is determined relative to the size of the field, so I reckon that would still count as author sized.

@cwilcox808

yatil,
@yatil@yatil.social avatar

@siblingpastry @cwilcox808 🤷‍♂️

joelanman,
@joelanman@hachyderm.io avatar

@cwilcox808 @siblingpastry @yatil Another aspect of us switching to inputmode is type=number silently rejects non numeric input which we don't think is good practice, we have the same stance on maxlength

siblingpastry,
@siblingpastry@mastodon.world avatar

@joelanman @cwilcox808 @yatil fyi. putting aside the inputmode ux -- I can confirm there are no accessibility issues with the "number" type now.

joelanman,
@joelanman@hachyderm.io avatar

@siblingpastry @cwilcox808 @yatil I would argue the default hit area for the stepper buttons doesnt meet the minimum required (might be an exception since it's native but I think that's a technicality, it doesn't actually make it accessible)

siblingpastry,
@siblingpastry@mastodon.world avatar

@joelanman

It would pass that exception yeah. I'd assumed the spinbuttons would size with the field, but now I test that, they don't, they're always the same small size.

However it still passes 2.5.8 either way, because of equivalence -- the spinbuttons are not actually necessary. Which is also why their lack of direct keyboard accessibility doesn't matter.

@cwilcox808 @yatil

yatil,
@yatil@yatil.social avatar

@siblingpastry That depends on what “supported” means for you and your project 😂

siblingpastry,
@siblingpastry@mastodon.world avatar

@yatil 😝

  • All
  • Subscribed
  • Moderated
  • Favorites
  • accessibility
  • rosin
  • magazineikmin
  • GTA5RPClips
  • khanakhh
  • InstantRegret
  • Youngstown
  • mdbf
  • slotface
  • thenastyranch
  • everett
  • osvaldo12
  • kavyap
  • cubers
  • DreamBathrooms
  • megavids
  • Durango
  • modclub
  • ngwrru68w68
  • vwfavf
  • ethstaker
  • tester
  • cisconetworking
  • tacticalgear
  • Leos
  • provamag3
  • normalnudes
  • anitta
  • JUstTest
  • All magazines