Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd35ebef

Browse files
committed
fix(nav-link): cNavLink directive loosing tabindex attribute, refactor;
1 parentf1592f3 commitd35ebef

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

‎projects/coreui-angular/src/lib/nav/nav-link.directive.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import{booleanAttribute,computed,Directive,effect,input}from'@angular/core';
1+
import{booleanAttribute,computed,Directive,effect,input,numberAttribute}from'@angular/core';
2+
import{BooleanInput}from'../coreui.types';
23

34
@Directive({
45
selector:'[cNavLink]',
@@ -12,6 +13,8 @@ import { booleanAttribute, computed, Directive, effect, input } from '@angular/c
1213
}
1314
})
1415
exportclassNavLinkDirective{
16+
staticngAcceptInputType_disabled:BooleanInput;
17+
1518
/**
1619
* Sets .nav-link class to the host. [docs]
1720
*@default true
@@ -30,20 +33,25 @@ export class NavLinkDirective {
3033
*/
3134
readonlydisabled=input(false,{transform:booleanAttribute});
3235

36+
/**
37+
* The tabindex attribute specifies the tab order of an element (when the "tab" button is used for navigating).
38+
*/
39+
readonlytabindex=input(undefined,{transform:numberAttribute});
40+
3341
readonlyariaCurrent=computed(()=>{
3442
returnthis.active() ?'page' :null;
3543
});
3644

3745
ariaDisabled:boolean|null=null;
3846
attrDisabled:boolean|string|null=null;
39-
attrTabindex:'-1'|null=null;
47+
attrTabindex:number|null=null;
4048
styleCursor:'pointer'|null=null;
4149

4250
readonly #disabledEffect=effect(()=>{
4351
constdisabled=this.disabled();
4452
this.ariaDisabled=disabled||null;
4553
this.attrDisabled=disabled ?'' :null;
46-
this.attrTabindex=disabled ?'-1' :null;
54+
this.attrTabindex=disabled ?-1 :(this.tabindex()??null);
4755
this.styleCursor=disabled ?null :'pointer';
4856
});
4957

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp