Skip to content

Commit

Permalink
Frontend: Focus page when expand page is triggered
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinSRG committed Sep 9, 2023
1 parent b40fc1d commit 91849e9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions frontend/src/components/layout/PageContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<script lang="ts">
import { AppEvents } from "@/control/app-events";
import { AppStatus } from "@/control/app-status";
import { defineAsyncComponent, defineComponent } from "vue";
import { defineAsyncComponent, defineComponent, nextTick } from "vue";
import { AuthController } from "@/control/auth";
import { KeyboardManager } from "@/control/keyboard";
Expand Down Expand Up @@ -185,7 +185,18 @@ export default defineComponent({
expandPage: function () {
AppStatus.ExpandPage();
this.$el.focus();
nextTick(() => {
const page: any = document.querySelector(".page-content");
if (page) {
const autoFocused = page.querySelector(".auto-focus");
if (autoFocused) {
autoFocused.focus();
} else {
page.focus();
}
}
});
},
closePage: function () {
Expand Down

0 comments on commit 91849e9

Please sign in to comment.