mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 11:27:31 -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
|
||||
v-model:active="isActive"
|
||||
:initial-focus="() => $refs.content"
|
||||
:return-focus-on-deactivate="!noReturnFocus"
|
||||
:return-focus-on-deactivate="false"
|
||||
@deactivate="close"
|
||||
>
|
||||
<div
|
||||
|
@ -67,6 +66,8 @@
|
|||
]"
|
||||
:style="{ zIndex }"
|
||||
@click.self="onBgClick"
|
||||
v-focus
|
||||
tabindex="-1"
|
||||
>
|
||||
<slot :max-height="maxHeight" :type="type"></slot>
|
||||
</div>
|
||||
|
@ -179,6 +180,7 @@ let transitionDuration = $computed(() =>
|
|||
|
||||
let contentClicking = false;
|
||||
|
||||
const focusedElement = document.activeElement;
|
||||
function close(ev, opts: { useSendAnimation?: boolean } = {}) {
|
||||
// removeEventListener("popstate", close);
|
||||
// if (props.preferType == "dialog") {
|
||||
|
@ -192,6 +194,9 @@ function close(ev, opts: { useSendAnimation?: boolean } = {}) {
|
|||
if (props.src) props.src.style.pointerEvents = "auto";
|
||||
showing = false;
|
||||
emit("close");
|
||||
if (!props.noReturnFocus) {
|
||||
focusedElement.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function onBgClick() {
|
||||
|
|
Loading…
Reference in a new issue