Skip to content

Commit b688e6d

Browse files
committed
use overflow-y: overlay
1 parent 59bb6dc commit b688e6d

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

beta/src/components/Layout/Sidebar/SidebarRouteTree.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ export function SidebarRouteTree({
148148
{index !== 0 && (
149149
<li
150150
role="separator"
151-
className="mt-4 mb-2 ml-5 xs:mx-5 border-b border-border dark:border-border-dark"
151+
className="mt-4 mb-2 mx-5 sm:mr-0 border-b border-border dark:border-border-dark"
152152
/>
153153
)}
154154
<h3
155155
className={cn(
156-
'mb-1 text-sm font-bold ml-5 xs:mx-5 text-tertiary dark:text-tertiary-dark',
156+
'mb-1 text-sm font-bold mx-5 sm:mr-0 text-tertiary dark:text-tertiary-dark',
157157
index !== 0 && 'mt-2'
158158
)}>
159159
{sectionHeader}

beta/src/components/Layout/SidebarNav/SidebarNav.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function SidebarNav({
3131

3232
return (
3333
<div className={cn('sticky top-0 lg:bottom-0 lg:h-screen flex flex-col')}>
34-
<div className="overflow-y-scroll no-bg-scrollbar lg:w-[342px] grow bg-wash dark:bg-wash-dark">
34+
<div className="overflow-y-overlay no-bg-scrollbar lg:w-[342px] grow bg-wash dark:bg-wash-dark">
3535
<aside
3636
className={cn(
3737
`lg:grow lg:flex flex-col w-full pb-8 lg:pb-0 lg:max-w-xs z-10 hidden lg:block`

beta/src/components/Layout/TopNav/TopNav.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ export default function TopNav({
290290
{isOpen && (
291291
<div
292292
ref={scrollParentRef}
293-
className="overflow-y-scroll no-bg-scrollbar lg:w-[342px] grow bg-wash dark:bg-wash-dark">
293+
className="overflow-y-overlay no-bg-scrollbar lg:w-[342px] grow bg-wash dark:bg-wash-dark">
294294
<aside
295295
className={cn(
296296
`lg:grow lg:flex flex-col w-full pb-8 lg:pb-0 lg:max-w-xs z-50`,
@@ -302,7 +302,7 @@ export default function TopNav({
302302
className="w-full lg:h-auto grow pr-0 lg:pr-5 pt-4 lg:py-6 md:pt-4 lg:pt-4 scrolling-touch scrolling-gpu">
303303
{/* No fallback UI so need to be careful not to suspend directly inside. */}
304304
<Suspense fallback={null}>
305-
<div className="pl-3 xs:px-5 xs:gap-0.5 xs:text-base flex flex-row lg:hidden text-base font-bold text-secondary dark:text-secondary-dark">
305+
<div className="px-5 sm:pl-3 sm:pr-0 xs:gap-0.5 xs:text-base flex flex-row lg:hidden text-base font-bold text-secondary dark:text-secondary-dark">
306306
<NavItem isActive={section === 'learn'} url="/learn">
307307
Learn
308308
</NavItem>
@@ -322,7 +322,7 @@ export default function TopNav({
322322
</div>
323323
<div
324324
role="separator"
325-
className="ml-5 xs:mx-5 mt-4 mb-2 border-b border-border dark:border-border-dark"
325+
className="mx-5 sm:mr-0 mt-4 mb-2 border-b border-border dark:border-border-dark"
326326
/>
327327
<SidebarRouteTree
328328
// Don't share state between the desktop and mobile versions.

beta/src/styles/index.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,16 @@
224224
html.dark .no-bg-scrollbar::-webkit-scrollbar-thumb:active {
225225
background-color: rgba(255, 255, 255, 0.35) !important;
226226
}
227+
228+
/*
229+
* 'overlay' is a deprecated value, but works with the .no-bg-scrollbar solution
230+
* so the scrollbar width doesn't offset the containing element's width.
231+
* We can go back to using 'scroll' when .no-bg-scrollbar is no longer needed.
232+
*/
233+
html .overflow-y-overlay {
234+
overflow-y: scroll; /* For Firefox. */
235+
overflow-y: overlay; /* For WebKit-based browsers. */
236+
}
227237
}
228238

229239
.code-step * {

0 commit comments

Comments
 (0)