@4rk/vue-roving-tabindex

Add a roving tabindex to a Vue component
3,142 16
Install
npm install @4rk/vue-roving-tabindex
Latest Version:2.0.0
Vue:3
Older releases:2
License:MIT
Last Updated:Jan 4, 2024
Links: GitHub  ·  npm
Maintainer: holmey

@4rk/vue-roving-tabindex

Add a roving tabindex to a Vue component. This is useful to implement keyboard navigation inside components according to WAI-ARIA.

Installation

import VueRovingTabindex from "@4rk/vue-roving-tabindex";

app.use(VueRovingTabindex);

Usage

<template>
  <ul v-roving-tabindex-container>
    <li><button type="button" v-roving-tabindex>foo</button></li>
    <li><button type="button" v-roving-tabindex>bar</button></li>
    <li><button type="button" v-roving-tabindex>baz</button></li>
  </ul>
</template>

Directive API

The package provides two Vue directives:

v-roving-tabindex-container

This directive denotes the boundary of a roving tabindex sequence. Add it to a parent element of the v-roving-tabindex elements.

It has a single boolean modifier to change the direction from vertical to horizontal:

<div v-roving-tabindex-container.horizontal />

v-roving-tabindex

This directive should be used on every focussable element inside a v-roving-tabindex-container that is part of the roving tabindex.

Its value can be set to false to remove the element from the roving tabindex:

<button type="button" v-roving-tabindex="false />

Related work

Related Packages

vue-skip-to

It helps people who only use the keyboard to jump to what matters most.

2,047 80
@pdanpdan/vue-keyboard-trap

Vue3 and Vue2 directive for keyboard navigation - roving movement and trapping i...

99,464 45
nuxt-a11y

This module integrates Axe tool for auditing website against common Accessibilit...

462
@vue-a11y/skip-to

It helps people who only use the keyboard to jump to what matters most.

80,477 80
@lexical/a11y

Framework-agnostic accessibility helpers (ARIA live regions, focus management, r...

12,617,619 23,971

Version History

Version Released Vue License
2.0.0 3.x MIT
1.2.0 2.x MIT
1.1.0 2.x MIT