Tabbable
Tabbable is an abstract component that makes elements perceivable for keyboard users.
If you also want to make a tabbable element clickable with Enter and Space, see Clickable.
#Installation
npm install reakit
Learn more in Get started.
#Usage
Tabbable
Disabled
Focusable
import { Tabbable } from "reakit/Tabbable";
function Example() {
return (
<>
<Tabbable>Tabbable</Tabbable>
<Tabbable disabled>Disabled</Tabbable>
<Tabbable disabled focusable>
Focusable
</Tabbable>
</>
);
}
#Accessibility
Tabbablehastabindexset to0by default. If it'sdisabledand notfocusable, thetabindexattribute is removed.Tabbablehasaria-disabledset totruewhen thedisabledprop is passed in.click,mouseDownandmouseOverevents aren't triggered when thedisabledprop is passed in.- Focus is automatically set on
Tabbablewhen it's clicked, which prevents inconsistencies between browsers.
Learn more in Accessibility.
#Composition
Learn more in Composition.
#Props
#Tabbable
-
disabledboolean | undefinedSame as the HTML attribute.
-
focusableboolean | undefinedWhen an element is
disabled, it may still befocusable. It works similarly toreadOnlyon form elements. In this case, onlyaria-disabledwill be set.