# interactive-supports-focus Elements with an interactive role and interaction handlers (mouse or key press) must be focusable. ## How do I resolve this error? ### Case: I got the error "Elements with the '${role}' interactive role must be tabbable". How can I fix this? This element is a stand-alone control like a button, a link or a form element. A user should be able to reach this element by pressing the tab key on their keyboard. Add the `tabIndex` property to your component. A value of zero indicates that this element can be tabbed to. ```jsx
``` -- or -- Replace the component with one that renders semantic html element like `
``` Marking an element with the role `presentation` indicates to assistive technology that this element should be ignored; it exists to support the web application and is not meant for humans to interact with directly. ## Rule details This rule takes an options object with the key `tabbable`. The value is an array of interactive ARIA roles that should be considered tabbable, not just focusable. Any interactive role not included in this list will be flagged as needing to be focusable (tabindex of -1). ```js { 'jsx-a11y/interactive-supports-focus': [ 'error', { tabbable: [ 'button', 'checkbox', 'link', 'searchbox', 'spinbutton', 'switch', 'textbox', ], }, ] } ``` The recommended options list interactive roles that act as form elements. Generally, elements with a role like `menuitem` are a part of a composite widget. Focus in a composite widget is controlled and moved programmatically to satisfy the prescribed [keyboard interaction pattern](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_generalnav) for the widget. The list of possible values includes: ```js [ 'button', 'checkbox', 'columnheader', 'combobox', 'grid', 'gridcell', 'link', 'listbox', 'menu', 'menubar', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'progressbar', 'radio', 'radiogroup', 'row', 'rowheader', 'searchbox', 'slider', 'spinbutton', 'switch', 'tab', 'tablist', 'textbox', 'toolbar', 'tree', 'treegrid', 'treeitem', 'doc-backlink', 'doc-biblioref', 'doc-glossref', 'doc-noteref', ] ``` ### Succeed ```jsx
void 0} /> Click me! Click me too! Click ALL the things! ``` ### Fail ```jsx Submit Next page ``` ## Accessibility guidelines - [WCAG 2.1.1](https://www.w3.org/WAI/WCAG21/Understanding/keyboard) ### Resources - [Chrome Audit Rules, AX_FOCUS_02](https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_focus_02) - [Mozilla Developer Network - ARIA Techniques](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_button_role#Keyboard_and_focus) - [Fundamental Keyboard Navigation Conventions](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_generalnav) - [WAI-ARIA Authoring Practices Guide - Design Patterns and Widgets](https://www.w3.org/TR/wai-aria-practices-1.1/#aria_ex)