Skip to content

Commit c8b2e73

Browse files
committed
fix(cdk-experimental/accordion): fix disabled trigger button can't be focused when skipDisabled=false
1 parent 25c31fd commit c8b2e73

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/cdk-experimental/accordion/accordion.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export class CdkAccordionPanel {
9393
'[attr.aria-expanded]': 'pattern.expanded()',
9494
'[attr.aria-controls]': 'pattern.controls()',
9595
'[attr.aria-disabled]': 'pattern.disabled()',
96+
'[attr.inert]': 'hardDisabled() ? true : null',
97+
'[attr.disabled]': 'hardDisabled() ? true : null',
9698
'[attr.tabindex]': 'pattern.tabindex()',
9799
'(keydown)': 'pattern.onKeydown($event)',
98100
'(pointerdown)': 'pattern.onPointerdown($event)',
@@ -115,6 +117,13 @@ export class CdkAccordionTrigger {
115117
/** Whether the trigger is disabled. */
116118
disabled = input(false, {transform: booleanAttribute});
117119

120+
/**
121+
* Whether this trigger is completely inaccessible.
122+
*
123+
* TODO(ok7sai): Consider move this to UI patterns.
124+
*/
125+
readonly hardDisabled = computed(() => this.pattern.disabled() && this.pattern.tabindex() < 0);
126+
118127
/** The accordion panel pattern controlled by this trigger. This is set by CdkAccordionGroup. */
119128
readonly accordionPanel: WritableSignal<AccordionPanelPattern | undefined> = signal(undefined);
120129

0 commit comments

Comments
 (0)