labelBehaviour
LabelBehaviour
(optional)
for v1 compatibility
V1 of react-reponsive-pagination used visually hidden span tags for screen reader labels (the current version uses only aria attributes). This prop can be used to re-enable the V1 behaviour (if preferred):
import ResponsivePagination from 'react-responsive-pagination'; import { srOnlySpanLabel } from 'react-responsive-pagination/labelBehaviour'; ... <ResponsivePagination ... labelBehaviour={srOnlySpanLabel()} />
By default 'sr-only' is used as the class for the visually hidden spans. To override this, pass srOnlyClassName
:
<ResponsivePagination ... labelBehaviour={srOnlySpanLabel({ srOnlyClassName: 'my-sr-only' })} />
The accessibility label for the active page defaults to (current)
, to override this pass a11yActiveLabel
:
<ResponsivePagination ... labelBehaviour={srOnlySpanLabel({ a11yActiveLabel: '(active)'})} />
(the active label can be turned off by passing a value of '')
For reference, here's an example of a visually hidden css style:
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;}