Skip to content

Commit c78be4e

Browse files
committed
perf(ActionList): replace :has([aria-disabled]) with data-is-disabled attribute
1 parent b69325f commit c78be4e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/react/src/ActionList/ActionList.module.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
}
122122
}
123123

124-
&:not(:has([aria-disabled], [disabled]), [data-has-subitem='true']) {
124+
&:not([data-is-disabled], [data-has-subitem='true']) {
125125
@media (hover: hover) {
126126
&:hover,
127127
&:active {
@@ -330,7 +330,7 @@
330330
/* disabled */
331331

332332
&[aria-disabled='true'],
333-
&:has([aria-disabled='true'], [disabled]) {
333+
&[data-is-disabled] {
334334
& .ActionListContent * {
335335
color: var(--control-fgColor-disabled);
336336
}
@@ -371,7 +371,7 @@
371371
}
372372

373373
/* When TrailingAction is in loading state, keep labels and descriptions accessible */
374-
&:has(.TrailingAction [data-loading='true']):not([aria-disabled='true']) {
374+
&:has(.TrailingAction [data-loading='true']):not([data-is-disabled]) {
375375
/* Ensure labels and descriptions maintain accessibility contrast */
376376
& .ItemLabel {
377377
color: var(--fgColor-default);

packages/react/src/ActionList/Item.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ const UnwrappedItem = <As extends React.ElementType = 'li'>(
256256
data-variant={variant === 'danger' ? variant : undefined}
257257
data-active={active ? true : undefined}
258258
data-inactive={inactiveText ? true : undefined}
259+
data-is-disabled={disabled ? true : undefined}
259260
data-has-subitem={slots.subItem ? true : undefined}
260261
data-has-description={slots.description ? true : false}
261262
className={clsx(classes.ActionListItem, className)}

0 commit comments

Comments
 (0)