bvaughn / react-resizable-panels

Home Page:https://react-resizable-panels.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panel seems to get clipped when dragging up

TheBuilderJR opened this issue · comments

It's quite an interesting bug. It gets clipped when dragging up but then gets unclipped when dragging down.

Here's a video of the bug:

Area.mp4

Here's my code

import Editor from "@monaco-editor/react";
import { Theme, useTheme } from "remix-themes";
import { Button } from "./ui/button";

export default function Component() {
  const [theme, setTheme] = useTheme();
  const editorTheme = theme === Theme.DARK ? "vs-dark" : "vs-light";

  return (
    <div className="flex flex-col h-full space-y-1">
      <Editor
        className="w-full h-full"
        defaultLanguage="sql"
        defaultValue="SELECT * FROM my_table LIMIT 10;"
        theme={editorTheme}
        options={{
          minimap: {
            enabled: false,
          },
        }}
      />
      <div className="flex items-center justify-end mr-3 justify-endspace-x-2">
        <Button>Submit</Button>
      </div>
    </div>
  );
}

Please share a full repro that I can run. Partial code isn't enough. The issue could be a bug with your CSS styling.

ok here you go, drag the top panel down and back up and notice the button gets hidden

https://codesandbox.io/p/sandbox/react-resizable-panels-forked-9cjsgy?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clsgbggwm00063b6ej470h6bt%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clsgbggwm00023b6evu49budj%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clsgbggwm00033b6e6r1y09cz%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clsgbggwm00053b6e7i08lau0%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clsgbggwm00023b6evu49budj%2522%253A%257B%2522id%2522%253A%2522clsgbggwm00023b6evu49budj%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clsgbheqk004j3b6ey5r6yirs%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A2%252C%2522startColumn%2522%253A60%252C%2522endLineNumber%2522%253A2%252C%2522endColumn%2522%253A60%257D%255D%252C%2522filepath%2522%253A%2522%252Fsrc%252FApp.js%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522activeTabId%2522%253A%2522clsgbheqk004j3b6ey5r6yirs%2522%257D%252C%2522clsgbggwm00053b6e7i08lau0%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clsgbggwm00043b6euubj3bat%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clsgbggwm00053b6e7i08lau0%2522%252C%2522activeTabId%2522%253A%2522clsgbggwm00043b6euubj3bat%2522%257D%252C%2522clsgbggwm00033b6e6r1y09cz%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clsgbggwm00033b6e6r1y09cz%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

Sandbox not found

It's likely that the Sandbox you're trying to access doesn't exist or you don't have the required permissions to access it.

sorry about that - first time using code sandbox to share a repro. here's a public link

https://codesandbox.io/p/sandbox/react-resizable-panels-forked-9cjsgy?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clsgbggwm00063b6ej470h6bt%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clsgbggwm00023b6evu49budj%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clsgbggwm00033b6e6r1y09cz%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clsgbggwm00053b6e7i08lau0%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clsgbggwm00023b6evu49budj%2522%253A%257B%2522id%2522%253A%2522clsgbggwm00023b6evu49budj%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clsgbheqk004j3b6ey5r6yirs%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A2%252C%2522startColumn%2522%253A60%252C%2522endLineNumber%2522%253A2%252C%2522endColumn%2522%253A60%257D%255D%252C%2522filepath%2522%253A%2522%252Fsrc%252FApp.js%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522activeTabId%2522%253A%2522clsgbheqk004j3b6ey5r6yirs%2522%257D%252C%2522clsgbggwm00053b6e7i08lau0%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clsgbggwm00043b6euubj3bat%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clsgbggwm00053b6e7i08lau0%2522%252C%2522activeTabId%2522%253A%2522clsgbggwm00043b6euubj3bat%2522%257D%252C%2522clsgbggwm00033b6e6r1y09cz%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clsgbggwm00033b6e6r1y09cz%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

This is a Flex/CSS overflow issue. You can't reproduce it by resizing the browser window to be shorter without even using this library.

To fix it, add overflow: hidden to the <section> element.

perfecto! thank you!

for future readers of this issue, you can simply add the overflow-hidden class on the <Editor component and it'll add it to the section element as @bvaughn suggested