Closed ItaiYosephi closed 4 weeks ago
Thanks for reporting. It indeed looks like a bug.
You can work around it by disabling accessibleWhenDisabled
only after the selected tab that got disabled loses focus, so the blur event can be triggered (and therefore remove the data-focus-visible
attribute):
function Tab(props: Ariakit.TabProps) {
const tab = Ariakit.useTabContext()!;
const selectedId = tab.useState("selectedId");
const defaultId = useId();
const id = props.id ?? defaultId;
return <Ariakit.Tab accessibleWhenDisabled={selectedId === id} {...props} />;
}
Current behavior
When selected tab goes disabled, it can sometimes get stuck with
data-focus-visible="true"
https://github.com/user-attachments/assets/033452bb-c353-4af3-8280-dc2ba09018f4
Steps to reproduce the bug
Two
Expected behavior
There should only be one tab with
data-focus-visible="true"
Workaround
https://github.com/ariakit/ariakit/issues/3941#issuecomment-2227092167
Possible solutions
No response