Skip to content

Fix DevTools shell pane resizing by binding grid tracks to split variables#36437

Open
ypingmoe wants to merge 1 commit intofacebook:mainfrom
ypingmoe:fix-devtools-shell-resize-36434
Open

Fix DevTools shell pane resizing by binding grid tracks to split variables#36437
ypingmoe wants to merge 1 commit intofacebook:mainfrom
ypingmoe:fix-devtools-shell-resize-36434

Conversation

@ypingmoe
Copy link
Copy Markdown

@ypingmoe ypingmoe commented May 8, 2026

Summary

This PR fixes a layout synchronization bug in the DevTools shell (packages/react-devtools-shell/index.html) where dragging the split divider updated the divider position visually, but did not reliably resize the iframe and DevTools panes.

The root cause was split state being updated in one place while grid track sizing could diverge. The fix makes grid sizing consistently variable-driven and toggles layout mode via container classes, so both divider behavior and pane dimensions are derived from the same source of truth.

Changes

  • Add explicit CSS variables for split sizing (--left-column-width, --top-row-height) and divider thickness.
  • Define layout-specific grid templates via #panes.leftright and #panes.topbottom.
  • Update setLayout() to:
    • set the relevant split CSS variable
    • switch layout classes on #panes
  • Keep divider sizing tied to --divider-size for consistency across orientations.
  • Remove manual divider offset coupling that could drift from actual grid track sizing.

Why this approach

Using CSS variables as the single source of truth for grid tracks ensures drag interactions and rendered pane sizes remain in sync. Class-based layout switching also reduces imperative style mutations and makes orientation behavior easier to reason about and maintain.

Testing

  • Run DevTools shell locally and open the shell page.
  • Verify Left/Right Split:
    • drag divider horizontally
    • both panes resize continuously with pointer movement
  • Verify Top/Bottom Split:
    • drag divider vertically
    • both panes resize continuously with pointer movement
  • Switch layouts repeatedly and confirm split behavior remains stable.

Fixes #36434

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 8, 2026

Hi @ypingmoe!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

​[DevTools Bug]: Draggable divider fails to resize panes in shell index.html

1 participant