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
Tabbable
hastabindex
set to0
by default. If it'sdisabled
and notfocusable
, thetabindex
attribute is removed.Tabbable
hasaria-disabled
set totrue
when thedisabled
prop is passed in.click
,mouseDown
andmouseOver
events aren't triggered when thedisabled
prop is passed in.- Focus is automatically set on
Tabbable
when it's clicked, which prevents inconsistencies between browsers.
Learn more in Accessibility.
#Composition
Learn more in Composition.
#Props
#Tabbable
-
disabled
boolean | undefined
Same as the HTML attribute.
-
focusable
boolean | undefined
When an element is
disabled
, it may still befocusable
. It works similarly toreadOnly
on form elements. In this case, onlyaria-disabled
will be set.