mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 05:17:39 -07:00
fix: autocomplete not being focused properly
This commit is contained in:
parent
a6b91549f6
commit
0b5886e014
1 changed files with 7 additions and 2 deletions
|
@ -19,8 +19,7 @@
|
||||||
>
|
>
|
||||||
<FocusTrap
|
<FocusTrap
|
||||||
v-model:active="isActive"
|
v-model:active="isActive"
|
||||||
:initial-focus="() => $refs.content"
|
:return-focus-on-deactivate="false"
|
||||||
:return-focus-on-deactivate="!noReturnFocus"
|
|
||||||
@deactivate="close"
|
@deactivate="close"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@ -67,6 +66,8 @@
|
||||||
]"
|
]"
|
||||||
:style="{ zIndex }"
|
:style="{ zIndex }"
|
||||||
@click.self="onBgClick"
|
@click.self="onBgClick"
|
||||||
|
v-focus
|
||||||
|
tabindex="-1"
|
||||||
>
|
>
|
||||||
<slot :max-height="maxHeight" :type="type"></slot>
|
<slot :max-height="maxHeight" :type="type"></slot>
|
||||||
</div>
|
</div>
|
||||||
|
@ -179,6 +180,7 @@ let transitionDuration = $computed(() =>
|
||||||
|
|
||||||
let contentClicking = false;
|
let contentClicking = false;
|
||||||
|
|
||||||
|
const focusedElement = document.activeElement;
|
||||||
function close(ev, opts: { useSendAnimation?: boolean } = {}) {
|
function close(ev, opts: { useSendAnimation?: boolean } = {}) {
|
||||||
// removeEventListener("popstate", close);
|
// removeEventListener("popstate", close);
|
||||||
// if (props.preferType == "dialog") {
|
// if (props.preferType == "dialog") {
|
||||||
|
@ -192,6 +194,9 @@ function close(ev, opts: { useSendAnimation?: boolean } = {}) {
|
||||||
if (props.src) props.src.style.pointerEvents = "auto";
|
if (props.src) props.src.style.pointerEvents = "auto";
|
||||||
showing = false;
|
showing = false;
|
||||||
emit("close");
|
emit("close");
|
||||||
|
if (!props.noReturnFocus) {
|
||||||
|
focusedElement.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBgClick() {
|
function onBgClick() {
|
||||||
|
|
Loading…
Reference in a new issue