Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(styles): change sidebar width in Firefox to avoid overlapping on #5591

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion beta/src/components/Layout/Nav/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,18 @@ export default function Nav({
}) {
const [isOpen, setIsOpen] = useState(false);
const [showFeedback, setShowFeedback] = useState(false);
const [isFirefox, setIsFirefox] = useState(false);
const scrollParentRef = useRef<HTMLDivElement>(null);
const feedbackAutohideRef = useRef<any>(null);
const {asPath} = useRouter();
const feedbackPopupRef = useRef<null | HTMLDivElement>(null);

useEffect(() => {
if (typeof window !== undefined) {
setIsFirefox(window.navigator.userAgent.indexOf('Firefox') > -1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you do this in an effect, the issue would still exist until hydration. then, by setting state, it would cause an extra re-render of the nav. seems not ideal. we should fix the CSS ideally.

}
}, []);

// In mobile mode, let the user switch tabs there and back without navigating.
// Seed the tab state from the router, but keep it independent.
const [tab, setTab] = useState(section);
Expand Down Expand Up @@ -330,7 +337,10 @@ export default function Nav({

<div
ref={scrollParentRef}
className="overflow-y-scroll no-bg-scrollbar lg:w-[336px] grow bg-wash dark:bg-wash-dark">
className={cn(
`overflow-y-scroll no-bg-scrollbar grow bg-wash dark:bg-wash-dark`,
isFirefox ? 'lg-w[310px]' : 'lg-w[336px]'
)}>
<aside
className={cn(
`lg:grow lg:flex flex-col w-full pb-8 lg:pb-0 lg:max-w-xs z-10`,
Expand Down