{"canonical_url":"https://engineer.company/glossary/focus-management/","content_markdown":"# Focus management\n\n## What it is\n\nFocus management governs where keyboard and assistive-technology interaction is\ndirected as an interface changes. The focused element receives ordinary keyboard\nactions or participates in the platform's navigation sequence. A user expects to\nsee where focus is and to be able to continue after opening a panel, dismissing\na dialog or moving to a new part of a page.\n\nBrowsers and native controls provide default movement and activation. Additional\nfocus decisions are useful when a meaningful transition changes the available\ncontent. A modal dialog can bring focus inside itself so the user can operate\nit. When it closes, the application can return focus to the control that opened\nit or choose a suitable next location if that control no longer exists. The\nuseful destination follows the user's next step.\n\nVisual focus is part of the outcome. The browser can focus an element that is\noffscreen or under another layer. A programmatic change to focus should leave\nthe target visible and understandable under the actual layout. Responsive\nchanges, overlays and scrolling make this relationship important to test.\n\n## Why it matters\n\nFocus gives a person a place to work. Suppose someone opens a confirmation\ndialog while processing a list of records. They need a clear indication that the\ndialog is active and a predictable way to reach the available actions. After\ncancelling, they should be able to resume from the record they were reviewing.\nAn unexpected move can make a short task take much longer.\n\nChanges can also remove the current point of interaction. A button may disappear\nonce a row is deleted. A filter can replace a list while a person is selecting\nfrom it. Focus can move to a stable nearby control or to a meaningful heading\nwhen that supports continuation. Choose the expected destination in the design\nbefore relying on whichever default a particular browser provides after the\nelement is gone.\n\nVisibility can fail even when focus is set correctly. A sticky toolbar can cover\nthe focused target when the browser scrolls it into view. A visually clipped\nregion can contain links that still receive focus. A person can lose track of\nthe current location despite the page accepting keyboard input. At multiple\nscreen sizes, observe where focus lands and whether the focused element remains\nvisible.\n\n## What it looks like in practice\n\nConsider a dialog opened from a row's action button. When it opens, put focus on\na useful initial element in the new context. Some dialogs benefit from focusing\na heading or an introductory passage so the user can read before acting. Check\nthe pattern your platform uses and include an available close operation. A modal\ndialog also needs to manage the keyboard sequence within its active context.\n\nTest cancelling and completing the action. After cancelling, verify that the\nperson can resume at the originating button. After a delete, that button may be\ngone. Move to a logical next row or a stable list control whose meaning is\nclear. Record the next element and which scroll position it produces. Repeat the\ntest for the last record, where the proposed next row is absent.\n\nEngineer's\n[case study on rendered accessibility defects](/portfolio/the-accessibility-faults-your-checker-misses/)\ndescribes links that stayed in the tab order while their visible region was\nclipped. It also records testing additional viewport heights. Those findings\napply directly to focus review. Confirm the visible focus point after each\ntransition and run the test in layouts where sticky or clipped regions can\nchange the result.\n\nAlso test a late response. A user may move elsewhere while an asynchronous\nrequest finishes. If the product automatically moves focus on completion, it can\ninterrupt the task the user chose after the request started. Decide whether a\nstatus update can communicate the result while focus stays where the user placed\nit. Test the case where the original control is no longer focused when the\nresponse arrives.\n\n## Where it goes wrong\n\nA focus rule can send every action to the same place even when the outcomes\ndiffer. A save might leave the current form available, while a delete removes\nthe row entirely. Make the expected continuation part of each behaviour. Record\nwhen focus moves and why. A test should cover keyboard paths as well as\npointer-triggered transitions where the browser still has a focused element.\n\nAnother issue is keeping hidden controls in the focus sequence. A visual effect\ncan conceal them without changing how interaction reaches them. Inspect the\nactual controls exposed while each region is open and closed. Check focus\nvisibility on a small screen and after browser zoom or text changes, especially\nwhere the layout has fixed-height areas.\n\nDistinguish the next point in the regular Tab sequence from an element that\nserves as an intentional landing place. A heading can provide useful context\nafter a transition without becoming an extra stop every time a reader tabs\nthrough the page. Use the platform's way to assign focus for that transition and\ncheck what the next Tab does. An apparently correct focused element can still\nleave the rest of the sequence confusing if the next action begins far from the\nuser's task.\n\nFinally, pay attention to failures while a UI transition is in progress. A\ndialog may close without a result. A list refresh may fail and leave its earlier\ncontrols visible. Provide a stable continuation for each case. Useful focus\nmanagement makes the user's position follow the task and leaves visible evidence\nwhen the interface changes around it.\n\n## Further reading\n\n- [WCAG Focus Order](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html).\n  Describes meaningful sequences for controls.\n- [WCAG Focus Not Obscured (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/focus-not-obscured-minimum.html).\n  Explains the minimum visibility requirement for focused components.\n- [WAI modal dialog pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/).\n  Gives expected behaviour for moving and restoring focus.\n\n\u003chttps://engineer.company/glossary/focus-management/\u003e\n","date_modified":"2026-11-25T07:18:46Z","description":"Trace focus into a dialogue, through its controls and back to a meaningful location after it closes.","formats":{"gemtext":"https://engineer.company/glossary/focus-management/index.gmi","gopher":"https://engineer.company/glossary/focus-management/gophermap","html":"https://engineer.company/glossary/focus-management/","json":"https://engineer.company/glossary/focus-management/index.json","markdown":"https://engineer.company/glossary/focus-management/index.md","pdf":"https://engineer.company/glossary/focus-management/index.pdf"},"kind":"page","language":"en","title":"What is focus management?","url":"https://engineer.company/glossary/focus-management/","version":1}