Post

Initial prototype of a `<toolbar>` element is coming along. Largely piggybacks off the focusgroup code so it's actually quite simple to do. Lots to discuss and tweak before it's finished but got to start somewhere.

14 reposts71 likes

It's built into the browser? Handling the keyboard behaviour automatically is a pretty big win over using a JS library for it, imo. Focusgroup has actually quite complex conflict handling for if you say put an input inside a toolbar. Doing this in a custom element would be quite a pain.

slightly off topic but what does happen when you put an element that shouldn't infer an implicit role inside the widget (like the input inside the toolbar or a link inside a tablist or something)?

They keep their intrinsic roles. I don't believe toolbar implies any, but tablist for example will set buttons to tab but most other items won't change role. Buttons was a recent change originally anything with its own role kept it, but I believe it was Sarah pointed out buttons really shouldnt.

ok... but that is not scalable at all if we need to convince browser vendors for every such use case. I'm sure some enjoy the control that gives them but damn... Looks like the primitives need fixing instead?

We add what 1 or 2 new html element every 5 years (I'm ignoring the weird permissions element stuff). That doesn't seem too unreasonable? I agree some stuff (CSS and even JavaScript) does move too fast at times but html is pretty conservative. Fwiw we are doing the primitive that's the focusgroup 1/

Exactly. Better to have a native implementation everyone can use than 500 (likely inaccessible) versions—assuming one knows how to make custom elements at all.

It's not all that different right now, it's akin to `<div focusgroup="toolbar">`. In fact it's using focusgroup under the hood in my prototype just without spawning the attribute. But there's potentially some extra things we can do, e.g. stricter key conflict handling.

One key difference I hope will be in Safari. They don't make buttons keyboard focusable by default, I'm hoping we can get agreement that inside of a toolbar element they are for the purposes of the arrow key navigation. Focusgroup right now doesn't affect that behaviour per the spec.

Yup, menu(list) and menubar are being worked on too. So I think with those 3 it's just tablist left to go! But they all have varying levels of complexity beyond just what focusgroup provides (admittedly toolbar itself is quite simple).

That's cool. I need to look into the proposals. For tablist, I imagine you'd want to go all in and provide a proper hide and reveal behaviour when switching between tabs.

Yeah exactly. I don't think it's actually super complex to do, but there's a lot of "tabs" in the wild that aren't actually tabs (in the aria sense) and one historical point of contention has been how do we stop people using tabs for the wrong thing.