zl程序教程

您现在的位置是:首页 >  其他

当前栏目

SAP Spartacus focus directive tabindex的默认值设置

SAP 设置 Spartacus 默认值 directive focus
2023-09-14 09:02:55 时间

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

这会触发set操作:

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

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

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

更多Jerry的原创文章,尽在:“汪子熙”: