What is focusgroup?

The focusgroup HTML attribute lets you add arrow-key navigation to groups of focusable elements — implementing the "roving tabindex" pattern natively without writing any JavaScript for focus management.

Composite widgets like toolbars, tablists, menus, radio groups, and listboxes typically need arrow-key navigation so they behave as a single tab stop. Traditionally, this required significant JS to manage focus with the "roving tabindex" pattern. With focusgroup, you simply add an attribute and the browser handles everything:

Quick Demo: Try It Now

Click on the first button below, then use arrow keys to navigate. Press Tab to exit.

focusgroup="toolbar inline wrap"

Explore the Demos

Each demo page showcases a specific UI pattern with interactive examples and source code.

Resources

Browser Support

The focusgroup attribute is an experimental feature. At the time of writing, you may need to enable experimental browser flags in Microsoft Edge or another Chromium-based browser:

  1. Open about://flags in Microsoft Edge or another Chromium-based browser
  2. Search for Experimental Web Platform features
  3. Set the flag to Enabled
  4. Restart the browser