REPOSITORY CODING · MEDIUM
Restore keyboard focus after a control becomes unavailable
Keyboard traversal loses its target at the end of the eligible list and returns to the wrong end when the current control is disabled or absent. Repair next/previous re-entry and circular navigation after eligibility ordering. Empty lists must still return null and no unavailable control may become a target.
Architecture ExtensionAccessible building visit planner
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
Angular · 50 minute session
- Buildings contain unique room IDs and unique links. Links connect distinct existing rooms, with positive metres, width, nonnegative slope, optional closed and oneWay flags, and kind corridor, ramp, stairs or lift.
- Route preferences default to stepFree=true, minWidth=80 and maxSlope=8. A link must be open, wide enough and no steeper than the limit. Stairs are excluded for step-free requests. Equality at width and slope limits is allowed.
- Links are bidirectional unless oneWay=true. Choose the eligible route with the lowest total metres; equal costs use lexical order of the complete link-ID sequence. Return rooms, links and distance rounded to three decimals. A room reaches itself at zero cost.
- Keyboard controls have unique IDs, tabIndex default zero, and optional hidden, disabled and inert flags. Exclude negative tabIndex and all unavailable controls. Positive indices come first in ascending order; ties and zero indices keep input order.
- Next and previous focus wrap within the eligible controls. If current is not eligible, next starts at the first and previous at the last. Empty lists return focus:null. Do not move actual browser focus: this task inspects declared control metadata.
- This is a training planning tool. Width is in centimeters, slope in percent, length in metres. It cannot certify a real building or replace an accessibility audit.