fix(ui): use focus-visible instead of focus to prevent sticky hover effect on click (#10651)
This commit is contained in:
@@ -131,7 +131,7 @@ export function SessionHeader() {
|
|||||||
<Portal mount={mount()}>
|
<Portal mount={mount()}>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="hidden md:flex w-[320px] p-1 pl-1.5 items-center gap-2 justify-between rounded-md border border-border-weak-base bg-surface-raised-base transition-colors cursor-default hover:bg-surface-raised-base-hover focus:bg-surface-raised-base-hover active:bg-surface-raised-base-active"
|
class="hidden md:flex w-[320px] p-1 pl-1.5 items-center gap-2 justify-between rounded-md border border-border-weak-base bg-surface-raised-base transition-colors cursor-default hover:bg-surface-raised-base-hover focus-visible:bg-surface-raised-base-hover active:bg-surface-raised-base-active"
|
||||||
onClick={() => command.trigger("file.open")}
|
onClick={() => command.trigger("file.open")}
|
||||||
aria-label={language.t("session.header.searchFiles")}
|
aria-label={language.t("session.header.searchFiles")}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1696,7 +1696,7 @@ export default function Layout(props: ParentProps) {
|
|||||||
<div
|
<div
|
||||||
data-session-id={props.session.id}
|
data-session-id={props.session.id}
|
||||||
class="group/session relative w-full rounded-md cursor-default transition-colors pl-2 pr-3
|
class="group/session relative w-full rounded-md cursor-default transition-colors pl-2 pr-3
|
||||||
hover:bg-surface-raised-base-hover focus-within:bg-surface-raised-base-hover has-[[data-expanded]]:bg-surface-raised-base-hover has-[.active]:bg-surface-base-active"
|
hover:bg-surface-raised-base-hover [&:has(:focus-visible)]:bg-surface-raised-base-hover has-[[data-expanded]]:bg-surface-raised-base-hover has-[.active]:bg-surface-base-active"
|
||||||
>
|
>
|
||||||
<Show
|
<Show
|
||||||
when={hoverEnabled()}
|
when={hoverEnabled()}
|
||||||
@@ -1819,7 +1819,7 @@ export default function Layout(props: ParentProps) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="group/session relative w-full rounded-md cursor-default transition-colors pl-2 pr-3 hover:bg-surface-raised-base-hover focus-within:bg-surface-raised-base-hover has-[.active]:bg-surface-base-active">
|
<div class="group/session relative w-full rounded-md cursor-default transition-colors pl-2 pr-3 hover:bg-surface-raised-base-hover [&:has(:focus-visible)]:bg-surface-raised-base-hover has-[.active]:bg-surface-base-active">
|
||||||
<Show
|
<Show
|
||||||
when={!tooltip()}
|
when={!tooltip()}
|
||||||
fallback={
|
fallback={
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
&:hover:not(:disabled) {
|
&:hover:not(:disabled) {
|
||||||
background-color: var(--surface-raised-base-hover);
|
background-color: var(--surface-raised-base-hover);
|
||||||
}
|
}
|
||||||
&:focus:not(:disabled) {
|
&:focus-visible:not(:disabled) {
|
||||||
background-color: var(--surface-raised-base-hover);
|
background-color: var(--surface-raised-base-hover);
|
||||||
}
|
}
|
||||||
&:active:not(:disabled) {
|
&:active:not(:disabled) {
|
||||||
|
|||||||
@@ -90,8 +90,8 @@
|
|||||||
/* color: var(--icon-hover); */
|
/* color: var(--icon-hover); */
|
||||||
/* } */
|
/* } */
|
||||||
}
|
}
|
||||||
&:focus:not(:disabled) {
|
&:focus-visible:not(:disabled) {
|
||||||
background-color: var(--surface-focus);
|
background-color: var(--surface-raised-base-hover);
|
||||||
}
|
}
|
||||||
&:active:not(:disabled) {
|
&:active:not(:disabled) {
|
||||||
background-color: var(--surface-raised-base-active);
|
background-color: var(--surface-raised-base-active);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
transition: opacity 0.15s ease;
|
transition: opacity 0.15s ease;
|
||||||
|
|
||||||
&:hover:not(:disabled),
|
&:hover:not(:disabled),
|
||||||
&:focus:not(:disabled),
|
&:focus-visible:not(:disabled),
|
||||||
&:active:not(:disabled) {
|
&:active:not(:disabled) {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
transition: opacity 0.15s ease;
|
transition: opacity 0.15s ease;
|
||||||
|
|
||||||
&:hover:not(:disabled),
|
&:hover:not(:disabled),
|
||||||
&:focus:not(:disabled),
|
&:focus-visible:not(:disabled),
|
||||||
&:active:not(:disabled) {
|
&:active:not(:disabled) {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not([data-expanded]):focus {
|
&:not([data-expanded]):focus-visible {
|
||||||
&[data-variant="secondary"] {
|
&[data-variant="secondary"] {
|
||||||
background-color: var(--button-secondary-base);
|
background-color: var(--button-secondary-base);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user