File tree Expand file tree Collapse file tree 4 files changed +17
-4
lines changed
components-examples/cdk-experimental/tabs/cdk-tabs Expand file tree Collapse file tree 4 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ export class CdkTabList {
137137 host : {
138138 'role' : 'tab' ,
139139 'class' : 'cdk-tab' ,
140+ '[class.cdk-active]' : 'pattern.active()' ,
140141 '[attr.id]' : 'pattern.id()' ,
141142 '[attr.tabindex]' : 'pattern.tabindex()' ,
142143 '[attr.aria-selected]' : 'pattern.selected()' ,
Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ export class TabPattern {
3737 /** A local unique identifier for the tab. */
3838 value : SignalLike < string > ;
3939
40+ /** Whether the tab is active. */
41+ active = computed ( ( ) => this . tablist ( ) ?. focusManager . activeItem ( ) === this ) ;
42+
4043 /** Whether the tab is selected. */
4144 selected = computed ( ( ) => this . tablist ( ) . selection . inputs . value ( ) . includes ( this . value ( ) ) ) ;
4245
Original file line number Diff line number Diff line change 2525 list-style : none;
2626 flex-direction : row;
2727 justify-content : center;
28- overflow : scroll;
2928}
3029
3130.example-tablist [aria-orientation = 'vertical' ] {
4342 display : block;
4443}
4544
45+ .example-tablist [aria-disabled = 'true' ] {
46+ background-color : var (--mat-sys-surface-dim );
47+ pointer-events : none;
48+ }
49+
4650.example-tab {
4751 gap : 16px ;
4852 padding : 16px ;
5256 border-radius : var (--mat-sys-corner-extra-small );
5357}
5458
55- .example-tab : hover,
56- .example-tab [ tabindex = '0' ] {
59+ .example-tablist : focus-within . example- tab: hover ,
60+ .example-tablist : focus-within . example- tab. cdk-active {
5761 outline : 1px solid var (--mat-sys-outline );
5862 background : var (--mat-sys-surface-container );
5963}
6771 background-color : var (--mat-sys-secondary-container );
6872}
6973
74+ .example-tab [aria-disabled = 'true' ] {
75+ background-color : var (--mat-sys-surface-dim );
76+ pointer-events : none;
77+ }
78+
7079.example-tabpanel {
7180 margin : 8px ;
7281}
Original file line number Diff line number Diff line change 4141 [selectionMode] ="selectionMode "
4242 >
4343 < li cdkTab value ="tab-1 " class ="example-tab "> tab 1</ li >
44- < li cdkTab value ="tab-2 " class ="example-tab "> tab 2</ li >
44+ < li cdkTab value ="tab-2 " class ="example-tab " disabled =" true " > tab 2</ li >
4545 < li cdkTab value ="tab-3 " class ="example-tab "> tab 3</ li >
4646 </ ul >
4747
You can’t perform that action at this time.
0 commit comments