fix(ui): don't scroll on settings item click when external or `_blank` target link (#2742)

zio/stable
Joaquín Sánchez 2024-04-03 15:59:42 +02:00 committed by GitHub
parent 59dda09cd4
commit bead2183b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -10,9 +10,11 @@ const props = defineProps<{
external?: true
large?: true
match?: boolean
target?: string
}>()
const router = useRouter()
const scrollOnClick = computed(() => props.to && !(props.target === '_blank' || props.external))
useCommand({
scope: 'Settings',
@ -39,11 +41,12 @@ useCommand({
:disabled="disabled"
:to="to"
:external="external"
:target="target"
exact-active-class="text-primary"
:class="disabled ? 'op25 pointer-events-none ' : match ? 'text-primary' : ''"
block w-full group focus:outline-none
:tabindex="disabled ? -1 : null"
@click="to ? $scrollToTop() : undefined"
@click="scrollOnClick ? $scrollToTop() : undefined"
>
<div
w-full flex px5 py3 md:gap2 gap4 items-center