File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
components-examples/cdk-experimental/listbox/cdk-listbox Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ export class CdkListbox<V> implements AfterViewInit {
140
140
host : {
141
141
'role' : 'option' ,
142
142
'class' : 'cdk-option' ,
143
+ '[class.cdk-active]' : 'pattern.active()' ,
143
144
'[attr.tabindex]' : 'pattern.tabindex()' ,
144
145
'[attr.aria-selected]' : 'pattern.selected()' ,
145
146
'[attr.aria-disabled]' : 'pattern.disabled()' ,
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ export class OptionPattern<V> {
48
48
. findIndex ( i => i . id ( ) === this . id ( ) ) ?? - 1 ,
49
49
) ;
50
50
51
+ /** Whether the option is active. */
52
+ active = computed ( ( ) => this . listbox ( ) ?. focusManager . activeItem ( ) === this ) ;
53
+
51
54
/** Whether the option is selected. */
52
55
selected = computed ( ( ) => this . listbox ( ) ?. selection . inputs . value ( ) . includes ( this . value ( ) ) ) ;
53
56
Original file line number Diff line number Diff line change 46
46
border-radius : var (--mat-sys-corner-extra-small );
47
47
}
48
48
49
- .example-option [ aria-disabled = 'false' ] : hover ,
50
- .example-option [tabindex = '0' ] {
49
+ .example-option . cdk-active ,
50
+ .example-option [aria-disabled = 'false' ] : hover {
51
51
outline : 1px solid var (--mat-sys-outline );
52
52
background : var (--mat-sys-surface-container );
53
53
}
61
61
background-color : var (--mat-sys-secondary-container );
62
62
}
63
63
64
- .example-option [aria-disabled = 'true' ]: focus - within ,
65
- .example-option [aria-disabled = 'true' ][ tabindex = '0' ] {
64
+ .example-option . cdk-active [aria-disabled = 'true' ],
65
+ .example-option [aria-disabled = 'true' ]: focus-within {
66
66
outline : 2px solid var (--mat-sys-outline );
67
67
}
68
68
You can’t perform that action at this time.
0 commit comments