Skip to content

Commit ecaade4

Browse files
committed
Make sure the mobile drawers can scroll if they overflow
1 parent e85a3cf commit ecaade4

File tree

2 files changed

+18
-25
lines changed

2 files changed

+18
-25
lines changed

frontend/src/components/Dialog/Dialog.module.css

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,20 @@
8989
display: flex;
9090
flex-direction: column;
9191

92+
/* Make sure the border radius cuts the content */
93+
overflow: hidden;
94+
contain: paint;
95+
96+
/* Cap the block size */
97+
max-block-size: calc(100vh - var(--cpd-space-4x));
98+
max-block-size: calc(100svh - var(--cpd-space-4x));
99+
92100
/* Drawer comes in the Android style by default */
93101
--border-radius: 28px;
94102
--handle-block-size: 4px;
95103
--handle-inline-size: 32px;
96104
--handle-inset-block-start: var(--cpd-space-4x);
97105
--handle-inset-block-end: 0px;
98-
--content-inset-block-start: calc(
99-
var(--handle-inset-block-start) +
100-
var(--handle-block-size) +
101-
var(--handle-inset-block-end)
102-
);
103106
}
104107

105108
.drawer[data-platform="ios"] {
@@ -111,31 +114,20 @@
111114
}
112115

113116
.drawer .body {
117+
overflow-y: auto;
118+
scrollbar-width: none;
114119
padding-inline: var(--cpd-space-4x);
115-
padding-block-start: calc(
116-
var(--content-inset-block-start) +
117-
var(--cpd-space-6x)
118-
);
120+
margin-block-start: var(--cpd-space-2x);
121+
padding-block-start: var(--cpd-space-4x);
119122
padding-block-end: var(--cpd-space-12x);
120-
border-start-start-radius: var(--border-radius);
121-
border-start-end-radius: var(--border-radius);
122-
123-
/* Even with overflow: auto, the content can still overflow at the corners
124-
where it meets with the curved border. A contain: paint fixes that. */
125-
contain: paint;
126-
overflow: auto;
127-
scrollbar-width: none;
128-
129-
--cpd-separator-spacing: 0;
130-
--cpd-separator-inset: var(--cpd-space-4x);
131123
}
132124

133-
.drawer .body::before {
134-
content: "";
135-
position: absolute;
125+
.drawer .handle {
126+
align-self: center;
136127
block-size: var(--handle-block-size);
137-
inset-inline: calc((100% - var(--handle-inline-size)) / 2);
138-
inset-block-start: var(--handle-inset-block-start);
128+
inline-size: var(--handle-inline-size);
129+
margin-block-start: var(--handle-inset-block-start);
130+
margin-block-end: var(--handle-inset-block-end);
139131
background: var(--cpd-color-icon-secondary);
140132
border-radius: var(--cpd-radius-pill-effect);
141133
}

frontend/src/components/Dialog/Dialog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const Dialog: React.FC<Props> = ({
6464
<Portal>
6565
<Drawer.Overlay className={styles.overlay} />
6666
<Drawer.Content className={styles.drawer} data-platform={platform}>
67+
<Drawer.Handle className={styles.handle} />
6768
<div className={styles.body}>{children}</div>
6869
</Drawer.Content>
6970
</Portal>

0 commit comments

Comments
 (0)