fix: don't spread dnd-kit attributes onto sortable tab triggers
useSortable's `attributes` (role="button", tabIndex, aria-pressed) were overriding Radix Tabs.Trigger's own role="tab" and roving-tabindex management, producing an invalid ARIA tab/role combination that regressed the accessibility audit. `listeners` alone (onPointerDown / onKeyDown) is sufficient to drive the drag — the trigger is already a properly accessible, focusable element. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
b31bd062e2
commit
dec6560cf0
1 file changed
+1
-2
@@ -27,7 +27,7 @@ const SortableTabsTrigger: FC<{ provider: (typeof providers)[ProviderKey]; isLoa
|
|||||||
provider,
|
provider,
|
||||||
isLoading
|
isLoading
|
||||||
}) => {
|
}) => {
|
||||||
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: provider.key });
|
const { listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: provider.key });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
@@ -35,7 +35,6 @@ const SortableTabsTrigger: FC<{ provider: (typeof providers)[ProviderKey]; isLoa
|
|||||||
value={provider.key}
|
value={provider.key}
|
||||||
style={{ transform: CSS.Transform.toString(transform), transition }}
|
style={{ transform: CSS.Transform.toString(transform), transition }}
|
||||||
className={cn('min-h-8 touch-none', isDragging && 'z-10 opacity-50')}
|
className={cn('min-h-8 touch-none', isDragging && 'z-10 opacity-50')}
|
||||||
{...attributes}
|
|
||||||
{...listeners}
|
{...listeners}
|
||||||
>
|
>
|
||||||
{isLoading ? <Loader className='animate-spin' size={14} /> : provider.label}
|
{isLoading ? <Loader className='animate-spin' size={14} /> : provider.label}
|
||||||
|
|||||||
Reference in new issue
Block a user