Thomas Kräftner

@kraftner
323 Followers
789 Following
1.5K Posts
👨‍💻 Senior one-man show trying to make the web nicer.
👪 Retired https://vienna.wordcamp.org #WCVIE orga
♂️ He/Him
🚀 #WordPress#WebDev#OpenSource#Simplicity#Privacy
Webhttps://kraftner.com/en
Githubhttps://github.com/kraftner
WordPresshttps://profiles.wordpress.org/kraftner

I just realized that in 12 years on Twitter I made 1410 tweets.

In less than 3 years on the Fediverse I've already exceeded that with over 1500 posts.

Thinking about it I guess it is mostly because I tend to interact way more here. Talking to people instead of screaming into a void and doing self promotion.

I like that.

This is where I am at now. In a bit of a desperate state.

I just need to enhance a select with autocomplete/search I thought. How hard can it be.

So: Help? Anyone?

#select #accessibility #webdev #html #aria

🧵 9/9

But here comes the catch: In my first attempt the whole USWDS feels very opinionated and monolitic. It seems to be meant to only be used as a whole and hence makes it very hard to integrate one tiny piece like the Combo box into a project. Even more so inside of Alpine.js.

🧵 8/9

Finally I looked at the US Design System. The have a Combo box pattern that looks promising:

https://designsystem.digital.gov/components/combo-box/

While it also builds on the combobox role and uses an `<input>` it does one thing different than the UK one: If you enter an invalid value and confirm or leave the field it resets to the last valid value. Which is exactly what we want here!

So basically it seems to tick all the boxes functionality wise!

🧵 7/9

Combo box

USWDS makes it easier to build accessible, mobile-friendly government websites.

U.S. Web Design System (USWDS)

I didn't find anything directly in the UK Design System. They do not have a <select> with search.

The closest is an input with autocomplete that seems to be based on the combobox pattern: https://github.com/alphagov/accessible-autocomplete

Unfortunately it has the same issue as the `<datalist>` solution: It is basically an `<input>` on steroids, not a `<select>` with search: You can leave the field with an invalid value.

🧵 6/9

GitHub - alphagov/accessible-autocomplete: An autocomplete component, built to be accessible.

An autocomplete component, built to be accessible. - alphagov/accessible-autocomplete

GitHub

Final straw: I started looking at solid Design Systems like the UK one (https://design-system.service.gov.uk) and the US one (https://designsystem.digital.gov/).

🧵 5/9

Home

Design your service using GOV.UK styles, components and patterns

Getting more and more desperate I looked at the raw ARIA combobox pattern (https://www.w3.org/TR/wai-aria-1.2/#combobox) but I *really* shouldn't implement something like this myself:

https://adrianroselli.com/2020/03/stop-using-drop-down.html#Combo

Also it has the same issue as the `<datalist>`: `<input>` on steroids, not `<select>` with search.

🧵 4/9

Accessible Rich Internet Applications (WAI-ARIA) 1.2

Accessibility of web content requires semantic information about widgets, structures, and behaviors, in order to allow assistive technologies to convey appropriate information to persons with disabilities. This specification provides an ontology of roles, states, and properties that define accessible user interface elements and can be used to improve the accessibility and interoperability of web content and applications. These semantics are designed to allow an author to properly convey user interface behaviors and structural information to assistive technologies in document-level markup. This version adds features new since WAI-ARIA 1.1 [wai-aria-1.1] to improve interoperability with assistive technologies to form a more consistent accessibility model for [HTML] and [SVG2]. This specification complements both [HTML] and [SVG2].

Something like https://select2.org/ was requested. But that it requires jQuery is non-ideal. Also it seems to have a11y issues https://github.com/select2/select2/issues?q=is%3Aissue%20state%3Aopen%20label%3Aaccessibility and time since last commit/release do not inspire confidence.

I've also looked at https://github.com/Choices-js/Choices but there seem to be even more a11y issues. Some issues with keyboard navigation already popped up for myself in the first 30 seconds of trying.

🧵 3/9

Getting Started | Select2 - The jQuery replacement for select boxes

Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and pagination (infinite scrolling) of results.

`<input>` with `<datalist>` was attempted in the awareness that it offers an `<input>` with autocomplete, not a `<select>` with search.

Being able to enter invalid options which only shows with validation annoys users.

Also browser/a11y support seems to be non-ideal as well:
https://adrianroselli.com/2023/06/under-engineered-comboboxen.html

🧵 2/9

Under-Engineered Comboboxen?

When I wrote Under-Engineered Text Boxen in 2019 I mentioned <datalist> (WHATWG, MDN) but did not dwell on it. Partly because support was poor at the time. Once Can I Use’s <datalist> entry listed Firefox on Android supporting it in version 110, I got excited and started testing to write…

Adrian Roselli

So my dear #webdev bubble, specifically the #accessibility bubble, maybe you can help. I am finding the following issue an unexpectedly hard nut to crack:

- a `<select>` that has too many options making it annoying for users to find their option
- the field must be limited to the available choices
- it is part of a UI built with https://alpinejs.dev editing a list of items, hence the `<select>` gets constantly created/destroyed

Here's my research&thinking so far

#select #html #aria

🧵 1/9

Alpine.js

A rugged, minimal framework for composing behavior directly in your markup.