rusackas opened a new pull request, #42009:
URL: https://github.com/apache/superset/pull/42009
### SUMMARY
Continues the incremental `jsx-a11y` rollout (follows #42006) by turning on
`click-events-have-key-events` as `error`. This is the keyboard-*operability*
companion to the `interactive-supports-focus` rule enabled in #42006: those
elements became keyboard-focusable there, and here they become
keyboard-activatable.
**Shared helper (the core of the PR):** adds
`handleKeyboardActivation(callback)` to `@superset-ui/core` — a small,
unit-tested util that returns an `onKeyDown` handler firing the callback on
Enter/Space (with `preventDefault`). Reviewers vet one helper instead of 80
bespoke handlers.
**Applied across all 80 violations (41 files):**
- Elements that already had `role="button"`/`tabIndex` get a mirrored
`onKeyDown={handleKeyboardActivation(sameHandler)}`.
- Bare clickable `<div>`s with no role (e.g. the AgGrid `CustomHeader` sort
menu items) also get `role="button"` + `tabIndex`, so the handler is actually
reachable rather than a linter-only fix.
- Pure event-boundary wrappers (whose `onClick` only `stopPropagation()`s —
a few tree/table containers) get a matching `onKeyDown={e =>
e.stopPropagation()}` instead of a meaningless activation.
- `ModalTrigger`'s `<div>` trigger gains `tabIndex` so the new handler is
focusable.
- One test-only mock (`spec/helpers/shim.tsx`) extends its existing
eslint-disable rather than adding runtime behavior to a stub.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — no visual change; keyboard users can now activate these controls with
Enter/Space.
### TESTING INSTRUCTIONS
- `cd superset-frontend && npm run lint` — passes clean with the rule set to
`error`.
- New `handleKeyboardActivation.test.ts` (Enter/Space fire, other keys
ignored) and an added `ActionButton` test asserting both the click path and the
keyboard path.
- Ran the 28 co-located Jest suites for the swept components (list pages,
cards, ListView, explore controls, tree, pivot table, modals) — 283 tests pass
(one unrelated pre-existing modal-animation flake in RowLevelSecurityList
passes in isolation).
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]