Fix jumping to top of page when opening menu
I also thought this would maybe fix one of the focustrap errors in the console, but no.
This commit is contained in:
parent
544e4bab51
commit
fcd9fa4adc
1 changed files with 5 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<FocusTrap v-bind:active="isActive">
|
<FocusTrap :active="false" ref="focusTrap">
|
||||||
<div tabindex="-1" v-focus>
|
<div tabindex="-1">
|
||||||
<div
|
<div
|
||||||
ref="itemsEl"
|
ref="itemsEl"
|
||||||
class="rrevdjwt _popup _shadow"
|
class="rrevdjwt _popup _shadow"
|
||||||
|
@ -206,6 +206,7 @@ import { i18n } from "@/i18n";
|
||||||
import { FocusTrap } from 'focus-trap-vue';
|
import { FocusTrap } from 'focus-trap-vue';
|
||||||
|
|
||||||
const XChild = defineAsyncComponent(() => import("./MkMenu.child.vue"));
|
const XChild = defineAsyncComponent(() => import("./MkMenu.child.vue"));
|
||||||
|
const focusTrap = ref();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
items: MenuItem[];
|
items: MenuItem[];
|
||||||
|
@ -316,6 +317,8 @@ function focusDown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
focusTrap.value.activate();
|
||||||
|
|
||||||
if (props.viaKeyboard) {
|
if (props.viaKeyboard) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
focusNext(itemsEl.children[0], true, false);
|
focusNext(itemsEl.children[0], true, false);
|
||||||
|
|
Loading…
Reference in a new issue