Skip to content

Commit 99c463a

Browse files
authored
scroll to the top on mobile when entering landscape mode (#1386)
* scroll to the top on mobile when entering landscape mode * format
1 parent 0046755 commit 99c463a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

client/src/views/Room.vue

+9-7
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ import OmniPlayer from "@/components/players/OmniPlayer.vue";
214214
import Chat from "@/components/Chat.vue";
215215
import UserList from "@/components/UserList.vue";
216216
import VideoQueue from "@/components/VideoQueue.vue";
217-
// import { goTo } from "vuetify/lib/services/goto/index.mjs";
217+
import { useGoTo } from "vuetify";
218218
import RoomSettingsForm from "@/components/RoomSettingsForm.vue";
219219
import ShareInvite from "@/components/ShareInvite.vue";
220220
import { granted } from "@/util/grants";
@@ -544,22 +544,24 @@ export default defineComponent({
544544
const queueTab = ref(0);
545545
const roomSettingsForm = ref<typeof RoomSettingsForm | null>(null);
546546
547+
const goTo = useGoTo();
547548
onMounted(() => {
548549
if (!orientation.isSupported.value) {
549550
return;
550551
}
551552
552-
watch(orientation.orientation, newOrientation => {
553+
watch(orientation.orientation, async newOrientation => {
553554
if (!newOrientation) {
554555
return;
555556
}
556557
if (isMobile.value) {
557558
if (newOrientation.startsWith("landscape")) {
558-
document.documentElement.requestFullscreen();
559-
// goTo(0, {
560-
// duration: 250,
561-
// easing: "easeInOutCubic",
562-
// });
559+
// this promise is rejected if the fullscreen request is denied
560+
await document.documentElement.requestFullscreen();
561+
goTo(0, {
562+
duration: 250,
563+
easing: "easeInOutCubic",
564+
});
563565
} else {
564566
document.exitFullscreen();
565567
}

0 commit comments

Comments
 (0)