Skip to main content

Practice ยท 3 of 3

Modal Focus Plan

Write focusPlan({ focusables, currentIndex }) returning the NEXT index when Tab is pressed forward and the PREVIOUS when Shift+Tab ({ forward } is boolean). Wrap around at both ends. Also return restoreTo โ€” always the value passed as restoreIndex (the opener) in the result object.

Difficulty: intermediate

Back to lesson: Practice: Component Systems โ€” Practice