前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >关于SAP Spartacus --cx-color-visual-focus的疑问

关于SAP Spartacus --cx-color-visual-focus的疑问

作者头像
Jerry Wang
发布2021-04-06 15:22:17
2650
发布2021-04-06 15:22:17
举报

I am working on an a11y issue and I have one doubt about --cx-color-visual-focus.

I know the fact that when a control in Spartacus is focused, the border color is rendered by --cx-color-visual-focus.The value of variable $visual-focus is defined as value #6D9DF7 in file projects\storefrontstyles\scss\theme\sparta_variables.scss. And in root.scss, via the following code:

代码语言:javascript
复制
:root {
  @each $color, $value in $theme-colors {
    --cx-color-#{$color}: #{$value};
  }
  ...
}

The variable --cx-color-visual-focus is populated with value #6D9DF7 .And my doubt is: when we press tab button, how Spartacus knows that the focus border must be rendered with --cx-color-visual-focus, but not other variables in root.scss? I guess there must be some “mapping rules” to bind “focus event” with “–cx-color-visual-focus”, however after I search via keyword --cx-color-visual-focus, I don’t find useful hint.

I found answer in url: https://sap.github.io/spartacus-docs/keyboard-accessibility/#css-styles

If you change the outline property, it may break accessibility in Spartacus, because the default visual focus indicator in Spartacus depends on the outline property.

two mixins with name visible-focus are refering --cx-color-visual-focus variable:

ok I found answer here: :focus-within did the trick when tab button is pressed.

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-02-13 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档