Aller au contenu

ADR 0004: Use angular-gridster2 with our own keyboard layer

Ce contenu n’est pas encore disponible dans votre langue.

  • Status: accepted
  • Date: 2026-11-21
  • Answers: question Q2 of the project charter, risk R9

The dashboard is a grid of widgets. Users move and resize widgets with a mouse or a touch screen (issue #9) and with a keyboard only (issue #10). Which library do we use for the grid, and how do we make it usable with a keyboard?

Drag and drop is a known accessibility problem: most grid libraries do not support moving or resizing items with a keyboard. GitLab notes the same limit for Gridstack, the library of its own grid layout.

  • Move, resize, collision handling and touch support for a 2D grid
  • Works well with Angular 22, standalone components and signals
  • Usable with a keyboard only, with screen reader announcements (risk R9)
  • The layout model is easy to save in the browser and in a link (ADR 0003)
  • Limited effort, maintained library
  • angular-gridster2
  • gridstack.js (with its Angular wrapper)
  • Angular CDK drag and drop
  • Our own grid (CSS Grid, Pointer Events and keyboard)

Chosen option: “angular-gridster2, with our own keyboard layer”, because it is built for Angular, follows Angular versions (version 22 supports Angular 22), and already handles drag, resize, collisions and touch. Its item model (x, y, cols, rows) is directly our layout model.

No library provides keyboard editing, so we build it ourselves:

  • Tab moves the focus from widget to widget.
  • Space or Enter selects the focused widget for moving; a second key press confirms the new position; Escape cancels.
  • Arrow keys move the selected widget by one cell.
  • Shift + arrow keys resize the selected widget.
  • Each change is announced to screen readers with an aria-live region (for example “Pipelines widget moved to column 3, row 2”).
  • Short instructions are linked to each widget with aria-describedby.

angular-gridster2 is used only inside our own DashboardGrid component. The rest of the application never imports it. If we have to replace the library later, only this component changes.

  • Good: drag, resize, collisions and touch work without custom code.
  • Good: no conversion between the grid model and the shared layout format.
  • Good: the keyboard layer is our own work and follows a known pattern.
  • Bad: the library has one main maintainer; a new Angular version may be supported late. Mitigation: the library stays behind DashboardGrid.
  • Bad: the keyboard layer is extra work (issue #10, size M).
  • Good: Angular-specific, versions follow Angular.
  • Good: drag, resize, push and swap of items, touch support.
  • Bad: no keyboard editing.
  • Bad: one main maintainer.
  • Good: the most popular grid library, used by GitLab; touch support.
  • Bad: no keyboard editing.
  • Bad: changes the page outside of Angular, which can conflict with our widgets rendered as dynamic Angular components.
  • Good: official library, maintained by the Angular team.
  • Bad: made for lists, not for a free 2D grid.
  • Bad: no resize; we would write resize and collisions ourselves.
  • Good: full control, accessibility designed from the start, no dependency.
  • Bad: one or two more days of work; collisions and touch are hard to get right.