Skip to content

Commit

Permalink
fix(ui): don't scroll on settings item click when external or `_blank…
Browse files Browse the repository at this point in the history
…` target link (#2742)
  • Loading branch information
userquin committed Apr 3, 2024
1 parent 59dda09 commit bead218
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/settings/SettingsItem.vue
Expand Up @@ -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',
Expand All @@ -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
Expand Down

0 comments on commit bead218

Please sign in to comment.