Skip to content

Commit

Permalink
refactor: isDisabled
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed May 19, 2024
1 parent 9551bda commit ce3e8b8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/react/src/utils/composite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,14 @@ export function isDisabled(
index: number,
disabledIndices?: Array<number>,
) {
const element = list[index];
const baseCheck =
element == null ||
element.hasAttribute('disabled') ||
element.getAttribute('aria-disabled') === 'true';

if (disabledIndices) {
return disabledIndices.includes(index);
}

return baseCheck;
const element = list[index];
return (
element == null ||
element.hasAttribute('disabled') ||
element.getAttribute('aria-disabled') === 'true'
);
}

0 comments on commit ce3e8b8

Please sign in to comment.