且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SAP Spartacus focus directive tabindex的默认值设置

更新时间:2022-02-14 23:45:21

base-focus的ngOnInit钩子里,会将requiredTabindex设置为-1:

SAP Spartacus focus directive tabindex的默认值设置这会触发set操作:

SAP Spartacus focus directive tabindex的默认值设置注释写得很清楚,对应button,和active links,即包含有效href属性的a标签,不需要显式设置tabindex,因此75行的if分支不会进入。

注意第93行的host属性检测:

SAP Spartacus focus directive tabindex的默认值设置下图这种a标签的design time设置,在运行时,routerLink会被Angular框架转换为ng-reflect-router-link, 而href属性的生成则是异步进行的:SAP Spartacus focus directive tabindex的默认值设置SAP Spartacus focus directive tabindex的默认值设置