Skip to content
SilktideHelp

On focus

Simply moving to an element, for example by pressing Tab, should never trigger a major change like loading a new page, submitting a form, or opening a pop-up.

This is a : automation cannot reliably tell from minified or framework JavaScript whether a focus handler changes context, so Silktide raises the prompt on each page and a person confirms it by tabbing.

Why this matters

Keyboard users move focus through a page to explore it, the way mouse users move the pointer - reaching a control is not the same as choosing to use it. If merely tabbing into a search box reloads the page, or reaching a button opens a dialog, keyboard and users are taken somewhere they did not ask to go, often losing their place and their work. People with motor impairments who navigate slowly, element by element, encounter these traps constantly.

This is success criterion 3.2.1 (On Focus), a requirement - part of the most basic conformance level.

What to check

  1. Tab through every focusable control on the page.
  2. Confirm that focus alone never navigates, submits a form, or opens a dialog or a new window.
  3. Focus handlers that only highlight a field, show a hint, or prepare data in the background are fine.

If focus never changes context, the finding.

How to fix it

  1. Move the action out of the focus handler. Navigation, submission, and dialogs should be triggered by an explicit action such as click, Enter, or a change the visitor confirms.
  2. Use focus handlers only for non-disruptive effects.
// Problem: reaching the field navigates immediately
searchBox.addEventListener('focus', () => {
  window.location.href = '/search';
});

// Fix: navigate only when the user chooses to act
searchBox.addEventListener('keydown', (event) => {
  if (event.key === 'Enter') {
    window.location.href = '/search';
  }
});

How Silktide tests this

Silktide cannot reliably detect focus-triggered context changes by inspecting listener source code - frameworks and minification make that brittle - so this check raises one review prompt per page describing what to verify by tabbing.

Learn more

Last updated

Was this page helpful?