Skip to content

Keyboard Navigation

Pantanal Grid provides comprehensive keyboard navigation support for accessible and efficient data interaction.

Keyboard Navigation

Instructions: Click on the grid to focus it, then use keyboard shortcuts to navigate. The keyboard support is always available when navigatable prop is enabled.

Header Shortcuts

  • Enter - Sort by column
  • Alt + Down - Open filter menu
  • Esc - Close filter menu
  • Ctrl + - Reorder column left
  • Ctrl + - Reorder column right

Body Shortcuts

  • Arrow Keys - Navigate cells
  • Page Up/Down - Navigate pages
  • Space - Select row
  • Ctrl + Space - Toggle selection
  • Shift + Space - Range selection
  • Home/End - First/last cell

Interactive Grid

Click on the grid to focus it, then try the keyboard shortcuts listed above. Use Tab to focus the grid.

ID
Name
Price
Category
Stock
1
Product A
$29.99
Electronics
150
2
Product B
$49.99
Clothing
75
3
Product C
$19.99
Accessories
200
4
Product D
$39.99
Electronics
50
5
Product E
$59.99
Clothing
100
6
Product F
$24.99
Accessories
300

Enabling Keyboard Navigation

Enable keyboard navigation by setting the navigatable prop to true:

vue
<PantanalGrid
  :rows="rows"
  :columns="columns"
  key-field="id"
  :navigatable="true"
/>

Keyboard Shortcuts

Header Shortcuts

ShortcutAction
EnterSort by the column
Alt + DownOpens the filter menu
EscCloses the filter menu
Ctrl + Left ArrowReorders the column with the previous one
Ctrl + Right ArrowReorders the column with the next one

Body Shortcuts

ShortcutAction
Arrow KeysNavigate over the cells
EnterToggles the expand and collapse state on group row
Page UpNavigates to the previous page
Page DownNavigates to the next page
SpaceSelects the row which holds the currently highlighted cell
Ctrl + SpaceSelects or deselects the current row while persisting the previously selected rows (only for multiple selection mode)
Shift + SpacePerforms range selection. Selects all the rows between the last selected one and the one which holds the focused cell
Shift + Arrow KeysAdds the row which holds the focused cell to the selection (only for multiple selection mode)
Ctrl + HomeFocuses the first focusable element inside the body
Ctrl + EndFocuses the last focusable cell in the last row
HomeFocuses the first focusable cell in the row
EndFocuses the last focusable cell in the row

Usage Example

vue
<script setup lang="ts">
import { ref } from 'vue'
import { PantanalGrid, type ColumnDef } from '@pantanal/grid'

const rows = ref([/* ... */])
const columns: ColumnDef[] = [/* ... */]
const selectedKeys = ref<number[]>([])

function handleSelectionChange(keys: number[]) {
  selectedKeys.value = keys
}
</script>

<template>
  <div>
    <p>Selected: {{ selectedKeys.length }} row(s)</p>
    <PantanalGrid
      :rows="rows"
      :columns="columns"
      key-field="id"
      :navigatable="true"
      :selectable="'multiple'"
      @selectionChange="handleSelectionChange"
    />
  </div>
</template>

Focus Management

The grid automatically manages focus when keyboard navigation is enabled:

  1. Click on the grid to focus it
  2. Press Tab to move focus to the grid
  3. Use arrow keys to navigate cells
  4. Press Esc to blur the grid

Accessibility

Keyboard navigation makes the grid fully accessible:

  • WCAG 2.1 Compliant: Follows accessibility guidelines
  • Screen Reader Support: Works with assistive technologies
  • No Mouse Required: All operations can be performed with keyboard only

See Also