Skip to content

Commit

Permalink
disable weird firefox-only vertical scroll in prose pre elements
Browse files Browse the repository at this point in the history
Signed-off-by: Vu Van Dung <me@joulev.dev>
  • Loading branch information
joulev committed Dec 20, 2023
1 parent d4373aa commit 3dd1ab6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/blogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ export const Figure = figure;

export function pre(props: React.ComponentPropsWithoutRef<"pre">) {
return (
<ScrollArea className="mx-auto max-w-prose overflow-x-auto px-0 py-3">
<pre {...props} className="m-0 rounded-none bg-transparent p-0" />
// These overflow-y-hidden are needed to prevent y-direction scrolling, which doesn't occur on
// Chromium-based browsers and Safari, but somehow shows up on Firefox. Why it even shows up, I
// don't know...
<ScrollArea className="mx-auto max-w-prose overflow-x-auto overflow-y-hidden px-0 py-3">
<pre {...props} className="m-0 overflow-y-hidden rounded-none bg-transparent p-0" />
<ScrollBar orientation="horizontal" />
</ScrollArea>
);
Expand Down

0 comments on commit 3dd1ab6

Please sign in to comment.