前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >关于SAP Spartacus focus视觉效果的实现原理分析

关于SAP Spartacus focus视觉效果的实现原理分析

作者头像
Jerry Wang
发布2021-04-06 15:21:51
3030
发布2021-04-06 15:21:51
举报

When we press tab key on Spartacus page, there will be a focus state border displaying which wraps the control being focused. The border is drawn as light blue color. See my screenshot1.My question: is this behavior implemented by some coding inside Spartacus, or provided by Angular out of the box? My assumption is, at least, it’s not the browser’s default behavior.I created a simple HTML page:

代码语言:javascript
复制
<html>
<head>
	<style>
	button {
		padding: 1px;
		margin: 5px;
	}
	</style>
</head>
<body>
<div>
<button>1</button>
<button>2</button>
<button>3</button>
<button>4</button>
<button>5</button>
</div>
</body>
</html>

And the focus border color is black. See my screenshot 2.

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

答案: Its a bit of a mix between Spartacus and default html. Usually, that border box will appear over any focused html element by default. But as we build more complex apps with angular for example, we can end up losing this default border box due to some way we’ve styled an element or have veered from default browser behaviour. In Spartacus’s instance, we have implemented a border box in css to make sure we can see this focused element that is a little more robust and themed so it works with more of our custom elements

I successfully find the implementation where our custom focus border is styled: projects\storefrontstyles\scss\cxbase\mixins_visible-focus.scss

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

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

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

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

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