Skip to content

Commit 8e868d4

Browse files
committed
fix: work around double scrollbar Safari bug 🙃
We were ending up with both `overflow-y-auto` and `overflow-hidden` and for some reason Safari was resolving this "conflict" by showing two scrollbars.
1 parent 112db46 commit 8e868d4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

‎app/components/CommandPalette.client.vue‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,15 @@ useEventListener(document, 'keydown', handleGlobalKeydown)
284284
{{ announcement }}
285285
</p>
286286

287+
<!-- noScroll: the results div handles its own scroll; without this, Safari shows
288+
a second scrollbar on the dialog element -->
287289
<Modal
288290
ref="modalRef"
289291
:id="dialogId"
290292
:modalTitle="$t('command_palette.title')"
291293
:modalSubtitle="viewMeta.subtitle"
292-
class="mx-auto mb-0 mt-4 max-w-[48rem] overflow-hidden p-0 sm:mt-[10vh]"
294+
class="mx-auto mb-0 mt-4 max-w-[48rem] p-0 sm:mt-[10vh]"
295+
no-scroll
293296
@close="handleDialogClose"
294297
>
295298
<div v-if="isOpen" class="-mx-6 -mt-6">

‎app/components/Modal.client.vue‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const props = defineProps<{
33
modalTitle: string
44
modalSubtitle?: string
5+
noScroll?: boolean
56
}>()
67
78
const dialogRef = useTemplateRef('dialogRef')
@@ -50,7 +51,8 @@ defineExpose({
5051
<dialog
5152
ref="dialogRef"
5253
closedby="any"
53-
class="w-[calc(100%-2rem)] bg-bg border border-border rounded-lg shadow-xl max-h-[90vh] overflow-y-auto overscroll-contain m-0 m-auto p-6 text-fg focus-visible:outline focus-visible:outline-accent/70"
54+
class="w-[calc(100%-2rem)] bg-bg border border-border rounded-lg shadow-xl max-h-[90vh] overscroll-contain m-0 m-auto p-6 text-fg focus-visible:outline focus-visible:outline-accent/70"
55+
:class="noScroll ? 'overflow-hidden' : 'overflow-y-auto'"
5456
:aria-labelledby="modalTitleId"
5557
:aria-describedby="modalSubtitleId"
5658
v-bind="$attrs"

0 commit comments

Comments
 (0)