Skip to content

Commit c84d4e8

Browse files
[Frame] Add scrollbar width buffer onto Content (#11891)
### WHY are these changes introduced? Part of Shopify/polaris-internal#1379 Follow up to #11826, this change is still behind a feature flag. * Moving scrollbar buffer from main to content in `Frame` since we moved the scrollbar to just the content * updating `scroll` -> `auto` ensures the scrollbar doesn't show up when there isn't any scroll. ## Tophat [Spin](https://admin.web.web-npdr.sophie-schneider.us.spin.dev/store/shop1/products?selectedView=all) * turn on scrollbars always show in settings, shorten the window so the scrollbar hides and shows and make sure there isn't a layout shift ![Screen Recording 2024-04-17 at 9 56 36 AM](https://github.com/Shopify/polaris/assets/20652326/9933ab0c-af83-46a4-b60b-d5626f785680) - [x] Chrome, Firefox, Safari - [x] Mobile
1 parent a60d8aa commit c84d4e8

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.changeset/unlucky-coats-add.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': patch
3+
---
4+
5+
Moved `Frame` scrollbar from main to content and set overflow-y from scroll to auto behind a feature flag

polaris-react/src/components/Frame/Frame.module.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@
279279
}
280280

281281
.Content-TopBarAndReframe {
282-
overflow-y: scroll;
282+
overflow-y: auto;
283283
/* stylelint-disable-next-line polaris/conventions/polaris/custom-property-allowed-list -- top bar global space */
284284
margin-bottom: var(--pg-top-bar-height);
285285
margin-right: var(--p-space-050);
@@ -293,6 +293,17 @@
293293
}
294294
}
295295

296+
.ScrollbarSafeArea-TopBarAndReframe {
297+
@media (--p-breakpoints-md-up) {
298+
/* stylelint-disable -- polaris/conventions/polaris/custom-property-allowed-list -- Polaris component custom properties */
299+
width: calc(
300+
100vw - var(--pg-navigation-width) -
301+
var(--pc-app-provider-scrollbar-width) - var(--p-space-150)
302+
);
303+
/* stylelint-enable -- polaris/conventions/polaris/custom-property-allowed-list */
304+
}
305+
}
306+
296307
.GlobalRibbonContainer {
297308
position: fixed;
298309
z-index: var(--p-z-index-3);

polaris-react/src/components/Frame/Frame.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,17 @@ class FrameInner extends PureComponent<CombinedProps, State> {
327327
styles['Content-TopBarAndReframe'],
328328
)}
329329
>
330-
{children}
330+
{features?.dynamicTopBarAndReframe ? (
331+
<div
332+
className={
333+
styles['ScrollbarSafeArea-TopBarAndReframe']
334+
}
335+
>
336+
{children}
337+
</div>
338+
) : (
339+
children
340+
)}
331341
</div>
332342
</main>
333343
</div>

0 commit comments

Comments
 (0)