Testing browser support for `focusgroup`

In my previous post, I mentioned that I’ve used the web install API in production. Specifically, I’ve used it on The Session. In order to do that, I had to register for the origin trial.

I’ve just signed up for another origin trial. This time it’s for the proposed focusgroup attribute:

The focusgroup HTML attribute is a proposed declarative way to add keyboard arrow-key navigation to composite widgets such as toolbars, tablists, menus, listboxes, etc. without writing any roving-tabindex JavaScript. One attribute replaces hundreds of lines of boilerplate.

I’ve got an HTML web component on The Session called tab-controls. And yes, there’s a bunch of code in there to listen for keyboard events and respond appropriately. I would very much like to rip that code out.

So now that I’ve opted into the origin trial, I’ve added this to my HTML:

<tab-controls role="tablist" focusgroup="tablist">

If this focusgroup attribute takes off, I’ll be able to remove the role attribute but for now, it’s very much needed.

In the JavaScript for my tab-controls custom element, I need to be able to detect support for focusgroup. Here’s how I’m doing it:

if (!this.focusgroup) {
// do all my key handling stuff here
}

Here’s the important thing: don’t use getAttribute('focusgroup') to test for browser support. That will return true if the attribute is in the HTML. But the attribute will only get converted into a property if the browser understands it.

Jake has a lot more detail on the differences between attributes and properties.

Anyway, I figured I’d share that little snippet in case you too were interested in trying out the focusgroup proposal using progressive enhancement.

Have you published a response to this? :

Responses

1 Share

# Shared by Nilesh Prajapati on Monday, March 9th, 2026 at 4:52pm

10 Likes

# Liked by Emmett on Monday, March 9th, 2026 at 3:53pm

# Liked by Nilesh Prajapati on Monday, March 9th, 2026 at 4:52pm

# Liked by Aaron Crowder on Monday, March 9th, 2026 at 4:54pm

# Liked by Simon B. Carstensen on Monday, March 9th, 2026 at 5:30pm

# Liked by Dion on Monday, March 9th, 2026 at 6:26pm

# Liked by Andy Davies on Monday, March 9th, 2026 at 6:26pm

# Liked by Maikel Krause on Monday, March 9th, 2026 at 8:20pm

# Liked by Robbert Broersma on Monday, March 9th, 2026 at 8:34pm

# Liked by Jacques Newman on Wednesday, March 11th, 2026 at 3:13pm

# Liked by Una Kravets on Wednesday, March 11th, 2026 at 4:43pm

Related posts

Netlify redirects and downloads

How to use HTML’s `download` attribute even if you’re storing your files on S3.

The datalist element on iOS 26

Once again, Safari has fucked up its implementation.

Manual ’till it hurts

Try writing your HTML in HTML, your CSS in CSS, and your JavaScript in JavaScript.

Multi-page web apps

A question via email…

Progressive disclosure with HTML

The `details` element is like the TL;DR of markup.

Related links

TIL: You Can Access A User’s Camera with Just HTML

The capture attribute is pretty nifty—and I just love that you get so much power in a declarative way:

<input type="file" accept="image/*" capture="environment">

Tagged with

Official Google Webmaster Central Blog [EN]: More options to help websites preview their content on Google Search

Google’s pissing over HTML again, but for once, it’s not by making up rel values:

A new way to help limit which part of a page is eligible to be shown as a snippet is the “data-nosnippet” HTML attribute on span, div, and section elements.

This is a direct contradiction of how data-* attributes are intended to be used:

…these attributes are intended for use by the site’s own scripts, and are not a generic extension mechanism for publicly-usable metadata.

Tagged with

Swapping Images with the Sizes Attribute | Filament Group, Inc., Boston, MA

The hits just keep on coming from the Filament Group. Here Scott shares a really clever technique for creating an image magnifier using the sizes attribute of the img element.

Tagged with

Google Code: Web Authoring Statistics

Useful markup statistics from Google, complete with snotty commentary.

Tagged with

Tagged with

Previously on this day

1 year ago I wrote Sessioning

Playing jigs’n’reels every night.

4 years ago I wrote When should there be a declarative version of a JavaScript API?

If the JavaScript API requires a user gesture, maybe it’s time for a new button type.

5 years ago I wrote March

Out of the ordinary.

5 years ago I wrote Content buddy

Moving words around.

6 years ago I wrote 41 hours in Galway

A weekend of food and music to celebrate my birthday.

7 years ago I wrote Handing back control

An emergent theme at An Event Apart Seattle 2019.

7 years ago I wrote Updating email addresses with Mailchimp’s API

A change in version 3 of Mailchimp’s API.

8 years ago I wrote A workshop on building for resilience

The progressive web: a day-long workshop.

11 years ago I wrote Huffduffing video

Now you can grab the audio from YouTube and Vimeo videos for your huffduffing pleasure.

17 years ago I wrote Crawlbar

Say it with me.

21 years ago I wrote Perfect timing

Just in time for South by SouthWest, the Washington post has published an article called “Texas Eat ‘Em” about barbecue in the Lone Star State:

22 years ago I wrote We'll always have Paris

I’m back from my weekend in Paris.

24 years ago I wrote Trout Thursday

Only 327 days to go.