Accessibility in React In our final tutorial article, we'll focus on (pun intended) accessibility, including focus management in React, which can improve usability and reduce confusion for both keyboard-only and screen reader users. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, and the terminal/command line. Learning outcomes: Implementing keyboard accessibility in React. Including keyboard users At this point, we've implemented all the features we set out to implement. Users can add a new task, check and uncheck tasks, delete tasks, or edit task names. Also, they can filter their task list by all, active, or completed tasks. Or, at least, they can do all of these things with a mouse. Unfortunately, these features are not very accessible to keyboard-only users. Let's explore this now. Exploring the keyboard usability problem Start by clicking on the input at the top of our app, as if you're going to add a new task. You'll see a thick, dashed outline around that input. This outline is your visual indicator that the browser is currently focused on this element. Press the Tab key, and you will see the outline appear around the "Add" button beneath the input. This shows you that the browser's focus has moved. Press Tab a few more times, and you will see this dashed focus indicator move between each of the filter buttons. Keep going until the focus indicator is around the first "Edit" button. Press Enter. The component will switch templates, as we designed, and you'll see a form that lets us edit the name of the task. But where did our focus indicator go? When we switch between templates in our component, we completely remove the elements from the old template and replace them with the elements from the new template. That means the element that we were focused on no longer exists, so there's no visual cue as to where the browser's focus is. This could confuse a wide variety of users — particularly users who rely on the keyboard, or users who use assistive technology. To improve the experience for keyboard and assistive technology users, we should manage the browser's focus ourselves. Aside: a note on our focus indicator If you click the "All", "Active", or "Completed" filter buttons with your mouse, you won't see a visible focus indicator, but you will do if you move between them with the Tab key on your keyboard. Don't worry — your code isn't broken! Our CSS file uses the :focus-visible pseudo-class to provide custom styling for the focus indicator, and the browser uses a set of internal rules to determine when to show it to the user. Generally, the browser will show a focus indicator in response to keyboard input, and might show it in response to mouse input. Doing this will populate our editFieldRef and editButtonRef with references to the DOM elements they're attached to, but only after React has rendered the component. Test that out for yourself: add the following line somewhere in the body of your Todo() function, below where editButtonRef is initialized: console.log(editButtonRef.current); You'll see that the value of editButtonRef.current is null when the component first renders, but if you click an "Edit" button, it will log the