Skip to content

Fixes #38034: keyboard-accessible drag handle for Tree reordering - #38062

Merged
Rohit0301 merged 7 commits into
mainfrom
detail/bug-fix/fixes-38034-keyboard-accessible-drag-handle-for-tr-bc9cee
Nov 18, 2026
Merged

Rohit0301 merged 7 commits into
mainfrom
detail/bug-fix/fixes-38034-keyboard-accessible-drag-handle-for-tr-bc9cee

Conversation

@detail-app

@detail-app detail-app Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Detail bug report: View on Detail

Describe your changes:

Fixes #38034

The shared Tree wrapper in @openmetadata/ui-core-components wired useDragAndDrop internally whenever a consumer supplied onItemMove, but did not render, export, or document the <Button slot="drag"> affordance React Aria's Tree requires for keyboard and screen-reader drag initiation. React Aria hardcodes hasDragButton: true for every draggable row, so the Enter/Space drag-start handlers are delivered through the drag slot — without a button there, rows are natively draggable (mouse works) but keyboard-only and screen-reader users could not start a reorder at all (WCAG 2.1.1). The four onItemMove consumers that rendered only an inert, aria-hidden grip icon affected:

  • pages/CustomizeAppModeSidebarPage/CustomizeAppModeSidebarPage.tsx
  • components/discovery/personal-space/Profile/tabs/personas/customize/NavigationEditor.tsx
  • components/discovery/personal-space/Profile/tabs/personas/customize/AiSidebarEditor.tsx
  • components/KnowledgeCenter/KnowledgePagesHierarchy/KnowledgePagesHierarchy.tsx

(pages/SettingsNavigationPage/SettingsNavigationPage.tsx was already correct — it rendered <ButtonUtility slot="drag"> directly — showing the omission was unintended.)

I worked on this because the wrapper's documented contract ("consumers don't need to import it from react-aria-components", "for full accessibility") was unfulfillable without React-Aria-specific knowledge the docstring never mentioned, and the gap blocked keyboard-only and screen-reader users from reordering on four screens.

Type of change:

  • Bug fix

High-level design:

N/A — small change. The wrapper now exports Tree.DragButton (mirroring the existing Tree.ExpandButton), rendering <Button slot="drag"> with a required aria-label and a default DotsGrid grip icon (aria-hidden). The onItemMove and Tree JSDoc now explicitly require a Tree.DragButton (or raw <Button slot="drag">) per draggable item, citing the WCAG 2.1.1 rationale and the React Aria dev warning. The four affected consumers swap the inert <DotsGrid aria-hidden> for <Tree.DragButton aria-label={t('label.move')}>, preserving each data-testid, the visible-on-hover styling, the canEditAll gating in KnowledgePagesHierarchy, and using tw:opacity-0 group-hover/focus-visible:opacity-100 so the handle stays keyboard-focusable when hidden (an aria-hidden icon was not focusable at all).

Tests:

Use cases covered

  • Keyboard-only and screen-reader users can focus the drag handle and press Enter to start a keyboard drag session in all four affected consumers (Persona Navigation editor, Persona AI-sidebar editor, App-Mode Sidebar customization page, Knowledge Center page hierarchy).
  • Pressing Tab during the drag session cycles drop targets and Enter drops, firing onItemMove with the correct { sourceKey, targetKey, dropPosition }.
  • Pressing Escape cancels the drag (no onItemMove).
  • Mouse drag-and-drop still works (the slot button carries pointer-events: none, so the row remains the pointer target).
  • The Knowledge Center handle still renders only when canEditAll is true; non-editors see no handle.

Unit tests

  • New openmetadata-ui-core-components/.../components/application/tree/tree.test.tsx (vitest, 6 tests) — covers the bug-state backstop (warns 3× when Tree.DragButton is missing), the fix (no warning when present, real focusable button with slot="drag" and aria-label, Enter starts the keyboard drag session and the source row gets data-dragging="true", second Enter drops and fires onItemMove), and the bug regression (Enter on the row does nothing when no Tree.DragButton is rendered).
  • Added backstop assertions to the three customize-editor Jest suites (NavigationEditor.test.tsx, AiSidebarEditor.test.tsx, KnowledgePagesHierarchy.test.tsx) — each queries getByRole('button', { name: 'label.move' }) and asserts the buttons have slot="drag" and are not aria-hidden; the KnowledgePagesHierarchy backstop also verifies no handle renders when EditAll is false.
  • Existing consumer Jest suites pass unchanged: 75/75 across 6 suites (the three customize editors, KnowledgePagesHierarchy, CustomizeAppModeSidebarPage.utils, and SettingsNavigationPage).

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Added keyboard users can reorder navigation items via the drag handle button (a11y regression) to playwright/e2e/Features/SettingsNavigationPage.spec.ts. It uses only the keyboard: it focuses the Home row, presses ArrowRight to reach the Move drag button, presses Enter to start the drag, presses ArrowDown twice to reach "Insert between Explore and Lineage" (checking each drop target gets focus), then presses Enter to drop. It then checks that Save is enabled and that the rows now start with Explore, then Home (/explore, /my-data).
  • While running it, I found that SettingsNavigationPage hid its drag button with tw:invisible. That removes the button from the accessibility tree, so ArrowRight skipped straight to the switch. The page now uses the same opacity-0 + focus-visible:opacity-100 pattern as the other consumers.
  • Ran locally against a 2.0.0-SNAPSHOT backend (--project=chromium --no-deps): all 9 tests in SettingsNavigationPage.spec.ts pass, including the existing mouse drag-and-drop tests.

Playwright run: SettingsNavigationPage.spec.ts, 9 passed

Keyboard reorder test steps

Visual regression baselines

  • Not applicable (the rendered drag handle uses the existing DotsGrid icon with the same display-on-hover pattern as before — no rendering change beyond substituting a real button for an aria-hidden SVG).

Manual testing performed

  • Ran the new WithDragAndDrop Storybook story with a Playwright probe: 4 rows render, 4 button[slot="drag"] elements with Move Databases / Move Tables / Move Views / Move Pipelines aria-labels, the inner grip SVG is aria-hidden="true", keyboard focus lands on the handle, and pressing Enter sets data-dragging="true" on the source row. No React Aria "must contain a <Button slot="drag">" dev warning fired.
  • Ran @axe-core/playwright against the rendered story; 0 violations for wcag2a/wcag21a/wcag2aa/wcag21aa (21 passing checks including aria-hidden-focus, aria-required-attr, aria-required-children; the lone incomplete is the iframe-scoped bypass check).

UI screen recording:

Screen.Recording.2026-11-18.at.11.30.29.AM.mov

Not applicable — standalone accessibility bug fix. Full-stack UI recording was blocked locally: the published docker.getcollate.io/openmetadata/server:2.0.0-SNAPSHOT manifest 404s (so the Docker dev stack with the fixed UI bundle could not be brought up at the matching version), and the only installable image (1.8.10) does not expose the /api/v1/auth/login endpoint Playwright's auth setup expects. The Storybook live probe and the axe-core scan above cover the rendered behaviour and the accessibility contract.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. (N/A — no schema changes.)
  • For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable).
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
  • Decision check: if this PR decides something the next contributor could undo — a schema field, REST path or format another component or repo must agree with, a new default or limit, an ordering that must hold, or a rule stated only in this description — it adds a record under docs/decisions/ (see its README.md). This decision adds a required-but-not-auto-rendered sub-component (Tree.DragButton) and documents the contract in the wrapper's JSDoc and stories; no separate ADR is needed because the contract is React Aria's, not new to this repo.

Automatic Fixes PRs can be configured here.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.

Summary

Adds Tree.DragButton and replaces inert drag icons in four consumers so keyboard users can start reordering.

  • Tree rows can be reordered from a keyboard-accessible drag handle.

Reviews (10) · Last reviewed commit: "Revert "Use core Button for knowledge pa..." · Reviewed by Greptile

…er E2E, trim test comments

- Render Tree.DragButton beside the page link/quick-link button instead of inside it
- Playwright: query the rendered 'Move' name and assert row order via data-key
- Drop narration comments from tree.test.tsx
…e E2E with real keys

tw:invisible removed the drag button from the accessibility tree, so ArrowRight
from a row skipped it. Hide it with opacity instead, like the other Tree
consumers. The keyboard reorder test now reaches the handle with ArrowRight,
walks drop targets with ArrowDown and asserts Home lands after Explore.
The quick-link <button> and page <Link> become one core Button (onPress for
quick links, href for pages; React Aria's RouterProvider keeps navigation
client-side). The delete button now sits beside the row link instead of
inside it.
@Rohit0301
Rohit0301 enabled auto-merge (squash) November 18, 2026 06:33
@Rohit0301
Rohit0301 merged commit af37fb3 into main Nov 18, 2026
55 checks passed
@Rohit0301
Rohit0301 deleted the detail/bug-fix/fixes-38034-keyboard-accessible-drag-handle-for-tr-bc9cee branch November 18, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Detail Bug] Accessibility: Tree drag-and-drop reordering cannot be initiated via keyboard/screen reader

3 participants