Skip to content

Make task card controls keyboard, screen reader and touch friendly - #388

Open
hoge6b01 wants to merge 2 commits into
donetick:developfrom
hoge6b01:fix/task-card-a11y
Open

hoge6b01 wants to merge 2 commits into
donetick:developfrom
hoge6b01:fix/task-card-a11y

Conversation

@hoge6b01

@hoge6b01 hoge6b01 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes three issues in CompactChoreCard (Home, compact task list, project board) where the card breaks requirements from PRODUCT.md: 44px touch targets, WCAG 2.1 AA, and a prefers-reduced-motion alternative for every animation. The card looks the same as before. Nothing visual changes, only how it behaves for keyboard, screen reader and touch users.

1. Hidden controls are no longer reachable

The leading slot stacks the complete button and the multi-select checkbox, and hides one of them with opacity: 0 + pointer-events: none. The hidden one stayed in the tab order and the accessibility tree. On Home, every card had an invisible, unnamed checkbox as a tab stop (axe label, critical). In multi-select mode the same happened the other way round with the complete button.

  • The hidden half is now aria-hidden, and its controls get tabIndex={-1}.
  • The checkbox gets a name: "Select {{name}}" (chores.selectTaskNamed).

2. Label chips are only tab stops when they do something

Every label chip sat in a <div role="none" tabIndex={0}>, so on Home (no onChipClick) each chip was an empty tab stop. Now:

  • Without onChipClick the wrapper is plain text.
  • With onChipClick (task list, board) the wrapper is a named button: "Filter by label {{name}}" (chores.filterByLabel). Space no longer scrolls the page.

3. 44px touch targets and reduced motion

The complete button is 32px and the approve button 24px (size="sm" with fixed sizes, so the theme's 44px rule doesn't apply).

  • A transparent ::after now extends their hit area to 44px. They keep their visual size.
  • On pointer: coarse the slot grows from 40 to 44px and its margin shrinks by the same 4px, so the task name stays exactly where it was.
  • The buttons' scale animation and the slot's fade/rotate transition now have a prefers-reduced-motion alternative that nulls transition and transform, following the convention in ThemeContext.

The two new keys are translated into all base locales.

Testing

  • New tests/compact-chore-card.test.mjs renders the real card with stubs (same approach as project-task-row.test.mjs). It covers the hidden checkbox and complete button in both modes, label chips with and without onChipClick (including keyboard), and the hit area and reduced-motion styles. All 5 tests fail on develop.
  • node --test tests/*.test.mjs shows no new failures. npx eslint/npx prettier -c on the changed files, npm run lint:i18n and scripts/i18n/i18n-pr-safety.mjs pass. vite build succeeds.
  • Headless browser on Home and the compact task list, German, mobile and desktop, light, dark and RTL, before vs. after:
    • axe label violations on Home go from 5 to 0, with no new violations.
    • Tab order no longer stops on the invisible checkbox or on label chips. In multi-select mode all checkboxes are reachable and no complete button is.
    • A tap 20px from the button's centre now hits it (before: missed). Size stays 32×32, and the task title keeps its exact position (LTR and RTL).
    • With prefers-reduced-motion: reduce, button and slot have no transition.

Not included, found while testing: the swipe actions behind each card (SwipeActionTray) are also in the tab order while hidden. That's a separate component and a separate PR.


Claude (Anthropic's AI assistant) helped with the analysis, implementation, tests and translations; I reviewed all changes.

🤖 Generated with Claude Code

@meauxt

meauxt commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Thank you for the contribution! Sorry, it will take me some time to test the PR and review them. I will try to get to them as soon as I can, so please bear with me.

hoge6b01 and others added 2 commits December 1, 2026 20:16
- The faded-out half of the leading slot (multi-select checkbox outside
  multi-select mode, complete/start/approve buttons inside it) is now
  aria-hidden and out of the tab order. The checkbox gets a name.
- Label chips are only focusable when they filter (onChipClick), and
  then act as named buttons; Space no longer scrolls the page.
- Complete and approve buttons take taps across 44px on touch screens
  (PRODUCT.md touch target) without changing their 32/24px look; the
  slot grows by the 4px the margin gives up, so the title stays put.
- Button and slot animations have a prefers-reduced-motion alternative.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CompactChoreCard now imports visibleLabels from utils/Labels (donetick#414), so the
module stub map needs an entry for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants