Separate tab focus from selection
A visual keyboard walkthrough of manual and automatic tabs, showing how focus, selection and panel content should stay understandable through each interaction.

A tab row has two questions to answer: which panel am I reading, and where will my next keyboard action go? With a mouse, these states often coincide. With manual keyboard activation, they can separate. A design that gives both states the same treatment can make a perfectly ordinary arrow-key move look like a broken panel switch.
Before approving the component, decide whether moving focus should also change the panel. Then capture the moment when the two states differ. That single frame is more revealing than a screenshot of the default tab.
Start with the activation decision
The W3C tabs pattern recommends automatic activation when a panel appears without noticeable latency. If reaching the panel involves waiting, manual activation lets someone move across the labels before committing to a selection. This is a behavior decision to make against the actual content-loading path, not a preference that the accent color can resolve. Read the tabs pattern.
What should Right Arrow do?
Automatic activation
Focus and selection move together.
- The newly focused tab immediately displays its panel.
- A useful choice when the real panel is ready without a noticeable wait.
- Check the loaded experience, not just an empty placeholder.
Manual activation
Focus moves first; activation selects.
- The current panel remains while another tab receives focus.
- Enter or Space activates the focused tab; a click also selects.
- Show the selected tab and keyboard focus separately.
Move focus without changing the panel
The fixture begins with Brief selected. We use Tab to reach it, then press Right Arrow once. In manual mode, the outline moves to Layout while the thick underline remains under Brief. The body still describes the project brief. The readout below the panel makes the two values explicit so a reviewer can check the screenshot without guessing.
After Right Arrow in manual mode. Real Chromium capture at a 390 px viewport, cropped to the working study. The outline and underline describe different states; the panel has not changed.Focus identifies the element receiving keyboard input; selection identifies the chosen item. W3C’s keyboard guidance treats these as distinct concepts. In a manual tab interface, moving the outline is therefore useful feedback even when the selected content stays in place. A CSS focus style should not masquerade as the selected-tab style. See the keyboard-interface guidance.
Activate, then check all three signals
Now we press Enter without moving focus. Layout gains the underline, the panel changes to the layout note, and the outline stays on Layout. Check these three signals together: focus, selection and visible content. A correct label with the wrong panel is still a defect; a changed panel without a clear selected state is harder to understand.
After Enter at the same viewport. Layout now has both indicators and its own content. The state readout is an editorial inspection aid, not a required part of a tab component.Observed with the same preloaded content in the original fixture| Action from Brief | Manual mode | Automatic mode |
|---|
| Right Arrow | Focus: Layout; panel: Brief | Focus: Layout; panel: Layout |
| Then Enter | Focus: Layout; panel: Layout | Focus: Layout; panel: Layout |
| Then End, then Space | Assets becomes selected | Assets becomes selected |
| Tab from a tab | Moves into the selected panel | Moves into the selected panel |
We checked both modes at 900 px and 390 px widths in Chromium, Firefox and WebKit. Enter, Space, Home, End, arrow wrapping and return to the selected tab behaved as asserted in the retained fixture checks. These are interaction observations, not timing benchmarks. WebKit’s default Tab traversal skipped the ordinary link after the widget in this environment; leaving the widget itself was verified.
Keep semantics, content and styling in agreement
The selected tab uses aria-selected="true"; its peers use false. That attribute communicates selection to accessibility APIs, but it does not draw an underline or change the panel for you. Our fixture uses the same selected value to update the attribute, the tab stop and the hidden panels. The selector for the visual treatment follows that attribute. Read the aria-selected reference.
// Selection routine from the study; not a complete tabs widget.
function activate(tab) {
tabs.forEach(item => {
const active = item === tab;
item.setAttribute('aria-selected', String(active));
item.tabIndex = active ? 0 : -1;
});
panels.forEach(panel => {
panel.hidden =
panel.id !== tab.getAttribute('aria-controls');
});
}
The surrounding widget still needs labeled tab and panel relationships, focus movement and event handling. In this study the tabs are buttons, so their native click activation handles Enter and Space. The manual arrow handler only moves focus. The automatic version also calls the selection routine when a tab receives focus. Keeping those responsibilities visible makes the choice easy to review.
For the visual design, we use an outline for focus and a thick lower edge for selection. Shape carries the distinction alongside color. W3C’s manual example similarly separates the two indicators and discusses high-contrast behavior. Our retained forced-colors capture is a useful inspection point, but it is not a screen-reader or device conformance result. Inspect the W3C manual example.
Review the moments between screenshots
Name the expected change
Write down whether Right Arrow should change only focus or also the panel. Test that choice with the real loading path.
Capture the split state
In manual mode, focus an unselected tab. Read the focused label, selected label and visible panel together.
Leave and return
Use Tab and Shift+Tab. Confirm where focus goes, then try Space, Enter and a pointer click.
Review the actual content
Try longer labels, a narrow viewport and high-contrast settings. Include assistive-technology testing before treating the component as production-ready.
For a design handoff, keep the split-state capture beside the default and activated states. Give the developer or coding agent the exact key sequence and expected labels. “Layout is focused while Brief stays selected until Enter” is a concrete acceptance condition that a screenshot, a test and a reviewer can all check.
Back to the LOOKFILE blog