@squiz/xaccel-accessibility
TypeScript icon, indicating that this package has built-in type declarations

1.15.1-beta.0 • Public • Published

Accessibility Utilities

Description

The utilities under accessibility include: a hook for making card-like design patterns into a fully-clickable area and a hook for enabling keyboard inputs to navigate overlays.

useAccessibleCard

Hook Properties

Property Property description Property type Is required
cardRef Reference to the Card element HTMLElement [x]
linkRef Reference to the Link that should be fully-clickable HTMLAnchorElement [x]

Usage

import { useAccessibleCard } from '@squiz/xaccel-accessibility';

function CardListItem({ url, title, description }) {
    const { cardRef, linkRef } = useAccessibleCard();

    return (
        <li ref={cardRef}>
            <a href={url} ref={linkRef}>{title}</a>
            <p>{description}</p>
        </li>
    );
}

useKeyboardOverlayListControl

Hook Properties

Property Property description Property type Is required
openActionRef Reference to the Button element HTMLButtonElement [x]
childItems Element that can be navigated through by keyboard HTMLElement[] [x]

Usage

const Component = React.forwardRef(({ ...props }, ref) => {
    const buttonRef = ref || useRef();

    const { containerProps, items, isOpen, setIsOpen } = useKeyboardOverlayListControl({
        openActionRef: buttonRef,
        childItems: children,
    });
});

/@squiz/xaccel-accessibility/

    Package Sidebar

    Install

    npm i @squiz/xaccel-accessibility

    Weekly Downloads

    22

    Version

    1.15.1-beta.0

    License

    ISC

    Unpacked Size

    122 kB

    Total Files

    20

    Last publish

    Collaborators

    • squiz-npm-publish
    • cdloh
    • pcoshansquiz
    • tadams_squiz
    • abarnes_squiz
    • gsherwood
    • pnolland
    • chadszinow-squiz
    • deborahsherwood
    • griseborough
    • akarelia
    • sdanis
    • tbernardes
    • oliverneal
    • azakens
    • azenderowska.squiz
    • lnowak
    • mdobie
    • bmatters
    • ewyatt
    • lwright-sq
    • cupreti
    • jmatthew_squiz
    • wjarosz
    • bxwu
    • carlfoster
    • samort
    • yyang1029
    • squiz-dwebster
    • tsmyth
    • aqureshi-sqz
    • rainger_squiz
    • ajhawar
    • hlee_squiz_npm
    • uqureshi
    • thomasgrob
    • avanschoor-squiz
    • ata-squiz
    • asharpe-squiz
    • aj12
    • squiz-lstephan
    • squiz-ncallahan
    • squiz-dschoen
    • squiz-ksilalahi
    • jpolgar-squiz
    • pkiriakou
    • hnarayanasamy
    • rmcavoy-squiz
    • asittirangsan
    • jchaware
    • lunowak-squiz
    • mnowakowski1
    • sholloway
    • pantyporowicz-squiz
    • djarrott.squiz.net
    • dkaczmarek
    • lineenan
    • aaronchan1010
    • haleesquiz
    • dpedroso
    • rszarafinski
    • tmadden
    • zackyang214
    • gdemelloesilva.squiz
    • jwrobel
    • bpottier