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 {
140140 host : {
141141 'role' : 'option' ,
142142 'class' : 'cdk-option' ,
143+ '[class.cdk-active]' : 'pattern.active()' ,
143144 '[attr.tabindex]' : 'pattern.tabindex()' ,
144145 '[attr.aria-selected]' : 'pattern.selected()' ,
145146 '[attr.aria-disabled]' : 'pattern.disabled()' ,
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ export class OptionPattern<V> {
4848 . findIndex ( i => i . id ( ) === this . id ( ) ) ?? - 1 ,
4949 ) ;
5050
51+ /** Whether the option is active. */
52+ active = computed ( ( ) => this . listbox ( ) ?. focusManager . activeItem ( ) === this ) ;
53+
5154 /** Whether the option is selected. */
5255 selected = computed ( ( ) => this . listbox ( ) ?. selection . inputs . value ( ) . includes ( this . value ( ) ) ) ;
5356
Original file line number Diff line number Diff line change 4646 border-radius : var (--mat-sys-corner-extra-small );
4747}
4848
49- .example-option [ aria-disabled = 'false' ] : hover ,
50- .example-option [tabindex = '0' ] {
49+ .example-option . cdk-active ,
50+ .example-option [aria-disabled = 'false' ] : hover {
5151 outline : 1px solid var (--mat-sys-outline );
5252 background : var (--mat-sys-surface-container );
5353}
6161 background-color : var (--mat-sys-secondary-container );
6262}
6363
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 {
6666 outline : 2px solid var (--mat-sys-outline );
6767}
6868
You can’t perform that action at this time.
0 commit comments