修复头部用户菜单关闭后按钮残留高亮,优化 hover 与 focus 样式。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -175,7 +175,11 @@ export default function MainLayout() {
|
||||
: <span className="header-user-initial">{userInitial}</span>}
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-40">
|
||||
<DropdownMenuContent
|
||||
align="end"
|
||||
className="w-40"
|
||||
onCloseAutoFocus={(e) => e.preventDefault()}
|
||||
>
|
||||
<DropdownMenuItem onClick={() => nav('/profile')}>个人中心</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => nav('/favorites')}>我的收藏</DropdownMenuItem>
|
||||
{user.role === 'admin' && (
|
||||
|
||||
@@ -355,14 +355,20 @@ a:hover { text-decoration: underline; }
|
||||
transition: box-shadow 0.15s, transform 0.1s;
|
||||
}
|
||||
|
||||
.header-user-btn:hover,
|
||||
@media (hover: hover) {
|
||||
.header-user-btn:hover {
|
||||
box-shadow: 0 0 0 2px var(--j13-green-bg), 0 0 0 3px var(--j13-green);
|
||||
}
|
||||
}
|
||||
|
||||
.header-user-btn:focus-visible {
|
||||
box-shadow: 0 0 0 2px var(--j13-green-bg), 0 0 0 3px var(--j13-green);
|
||||
}
|
||||
|
||||
/* 鼠标点击打开/关闭下拉后 focus 会回到按钮,隐藏默认黑色 outline */
|
||||
.header-user-btn:focus {
|
||||
/* 鼠标点击打开/关闭下拉后 focus 会回到按钮,隐藏默认 outline 与 hover 同款高亮 */
|
||||
.header-user-btn:focus:not(:focus-visible) {
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.header-user-avatar {
|
||||
|
||||
Reference in New Issue
Block a user