Coding task · JavaScript and TypeScript course · Module 8: Events and the DOM

Exercise: Tab Navigation

Create a tab navigation system for different dinosaur information sections.

Task

The index.html file has three tabs (role="tab") with panels and a keydown listener on the #dino-tabs container. The right arrow moves the focus to the next tab, and Enter selects the focused tab. Fill in the blanks: ___BLANK1___ is the event.key value of the left arrow (it moves the focus to the previous tab, from the first one to the last), and ___BLANK2___ is a condition that is true when Space is pressed (check event.key or event.code). Enter and Space should show the panel of the focused tab, and the arrows and Space must not scroll the page.