Integrate ConfigProvider to manage body scrolling behavior during modal interactions
- Added ConfigProvider component to prevent body scrolling when modals are open, enhancing user experience. - Included comments explaining the rationale behind the scroll-body setting to avoid layout shifts caused by dropdown menus.
This commit is contained in:
23
app/app.vue
23
app/app.vue
@@ -1,14 +1,33 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ConfigProvider } from 'reka-ui'
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<!--
|
||||||
|
scroll-body="false": Prevents body scrolling when modals/dialogs are open.
|
||||||
|
When set to false, the body element's overflow is locked while any modal component
|
||||||
|
(like Dialog, Sheet, etc.) is open, preventing background content from scrolling.
|
||||||
|
This improves UX by keeping focus on the modal content.
|
||||||
|
|
||||||
|
Bug fix: Without this setting, opening dropdown menus (e.g., the user profile menu
|
||||||
|
when clicking the avatar icon) would cause the body to receive a padding-right of
|
||||||
|
15px, which shifted the entire page content 15px to the left. This prop prevents
|
||||||
|
that unwanted padding injection and layout shift.
|
||||||
|
-->
|
||||||
|
<ConfigProvider :scroll-body="false">
|
||||||
<div>
|
<div>
|
||||||
<NuxtPage />
|
<NuxtPage />
|
||||||
</div>
|
</div>
|
||||||
|
</ConfigProvider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* Critical CSS - Loaded immediately to prevent FOUC */
|
/* Critical CSS - Loaded immediately to prevent FOUC */
|
||||||
html {
|
html {
|
||||||
background-color: #1e1440; /* purple-darkest */
|
background-color: #1e1440;
|
||||||
color: #f8fafc; /* white/slate-50 */
|
/* purple-darkest */
|
||||||
|
color: #f8fafc;
|
||||||
|
/* white/slate-50 */
|
||||||
font-family: 'Roboto', system-ui, -apple-system, sans-serif;
|
font-family: 'Roboto', system-ui, -apple-system, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user