diff --git a/client/src/components/Packing/PackingListPanel.test.tsx b/client/src/components/Packing/PackingListPanel.test.tsx index bbf1f8d23..9bb547336 100644 --- a/client/src/components/Packing/PackingListPanel.test.tsx +++ b/client/src/components/Packing/PackingListPanel.test.tsx @@ -269,7 +269,7 @@ describe('PackingListPanel', () => { const { container } = render(); // Only the category grip stays: the order of the categories is not the A to Z of their items. const draggable = [...container.querySelectorAll('[draggable="true"]')]; - expect(draggable.map((el) => el.getAttribute('aria-label'))).toEqual(['Drag to reorder the category']); + expect(draggable.map((el) => el.getAttribute('title'))).toEqual(['Drag to reorder the category']); }); it('FE-COMP-PACKING-023: inline edit item name via pencil icon calls PUT', async () => { diff --git a/client/src/components/Planner/PlaceFormModal.tsx b/client/src/components/Planner/PlaceFormModal.tsx index e7d0d7a1e..710b36b8a 100644 --- a/client/src/components/Planner/PlaceFormModal.tsx +++ b/client/src/components/Planner/PlaceFormModal.tsx @@ -12,6 +12,7 @@ import { PendingFiles, PlaceImageSection } from './PlaceFormMedia' import { usePlaceImageField } from './usePlaceImageField' import { useToast } from '../shared/Toast' import { Tooltip } from '../shared/Tooltip' +import { focusRevealedEditor } from '../shared/dialogFocus' import { Search, RotateCcw, LocateFixed, PencilLine } from 'lucide-react' import { useTranslation } from '../../i18n' import { PlaceContactFields } from './PlaceContactFields' @@ -644,7 +645,7 @@ export default function PlaceFormModal(props: PlaceFormModalProps) { type="text" // A new place starts at the search; an edit or a place brought // in from the map already has what the search would give. - data-initial-focus={(!place && !prefillCoords) || undefined} + ref={!place && !prefillCoords ? focusRevealedEditor : undefined} value={mapsSearch} onChange={e => { setMapsSearch(e.target.value); S.setEmptySearch(null) }} onKeyDown={handleSearchKeyDown} diff --git a/client/src/components/Tours/horse/RecordedRideFacts.test.tsx b/client/src/components/Tours/horse/RecordedRideFacts.test.tsx index 013912c42..4d4cebaba 100644 --- a/client/src/components/Tours/horse/RecordedRideFacts.test.tsx +++ b/client/src/components/Tours/horse/RecordedRideFacts.test.tsx @@ -98,7 +98,7 @@ describe('a ride taken from a GPX file (HOR-02)', () => { expect(facts).toHaveTextContent('No riding time'); expect(facts).toHaveTextContent('Access not checked'); // Each reason is the badge's description, reachable without a pointer. - const access = screen.getByText('Access not checked').closest('[tabindex="0"]') as HTMLElement; + const access = screen.getByRole('button', { name: 'Access not checked' }); expect(access).toHaveAccessibleDescription( 'The import does not check whether the ways may be ridden. The signs on site count.' ); diff --git a/client/src/components/shared/DialogShell.tsx b/client/src/components/shared/DialogShell.tsx index 96fa8eba5..cfcea28af 100644 --- a/client/src/components/shared/DialogShell.tsx +++ b/client/src/components/shared/DialogShell.tsx @@ -4,7 +4,7 @@ import { Trash2, X } from 'lucide-react' import { useTranslation } from '../../i18n' import { lockBodyScroll } from '../../utils/bodyScrollLock' import { Tooltip } from './Tooltip' -import { focusDialog, trapTab } from './dialogFocus' +import { focusDialog, focusRevealedEditor, trapTab } from './dialogFocus' import { useDiscardGuard } from './useDiscardGuard' /** A font size that follows the user's text size setting for its tier. */ @@ -252,7 +252,7 @@ export function DialogHeader(p: DialogHeaderProps) { onBlur={f.onBlur} aria-label={f.label} placeholder={f.placeholder} - data-initial-focus={f.autoFocus || undefined} + ref={f.autoFocus ? focusRevealedEditor : undefined} required={f.required} maxLength={f.maxLength} className="-mx-2 block w-[calc(100%+16px)] rounded-[10px] border-0 bg-transparent px-2 py-0.5 font-bold tracking-[-0.01em] text-content outline-none placeholder:font-semibold placeholder:text-content-faint hover:bg-surface-card focus:bg-surface-card focus:shadow-sm dark:bg-transparent dark:hover:bg-surface-card dark:focus:bg-surface-card"