Skip to content

Jalenevans/expandable output - #13

Merged
FedericoPonzi merged 5 commits into
tlaplus:mainfrom
JalenEvans:jalenevans/expandable-output
Aug 5, 2026
Merged

FedericoPonzi merged 5 commits into
tlaplus:mainfrom
JalenEvans:jalenevans/expandable-output

Conversation

@JalenEvans

Copy link
Copy Markdown
Contributor

The TLC output panel had a hard-coded height (h-48 open, h-8 collapsed), so anything longer than a few lines meant scrolling inside a tiny box. This makes the panel's top edge drag-resizable.

Closes #12

Key changes

  • TlcOutputPanel now tracks its open height as state (px) instead of a Tailwind height class, driven by a ResizableDivider direction="vertical" rendered at its top edge while open.
  • Height is clamped to [64px, max(64, window.innerHeight - 320)]. The 320 accounts for surrounding chrome (Navbar ~53 + Footer ~69 + Playground tab bar ~37) plus a ~160px editor floor, so the code editor always keeps usable room regardless of viewport size. The clamp re-applies if the window is resized shorter after a drag.
  • Collapsing and re-expanding remembers the last dragged height. The default (192px) and collapsed (32px) sizes match the old hard-coded values exactly, so nothing changes visually until a user actually drags.
  • The height transition is suppressed for the duration of a live drag so the panel tracks the cursor 1:1 instead of animating/rubber-banding.
  • ResizableDivider (also used by SplitLayout and the TLA+ intuition page) gained optional onDragStart/onDragEnd/ariaLabel props and role="separator" / aria-orientation / aria-label, all additive and backward compatible — the other two call sites are unchanged.
  • A drag now also ends on window blur, fixing a pre-existing bug where releasing the mouse outside the viewport (or alt-tabbing mid-drag) left the drag "stuck" with its document listeners still attached.

Testing

Added __tests__/TlcOutputPanel.test.tsx (13 new tests) covering the drag math, both clamp boundaries, collapse/re-expand height memory, no handle while collapsed, the collapsed border, aria-orientation, viewport-resize re-clamping, and blur-ends-drag. Full suite passes (25/25), and npm run build succeeds.

Since this is a static export (output: "export"), window is only read inside event handlers/effects, never during render or in a useState initializer, to keep prerendering working.

Out of scope (follow-ups)

  • Keyboard operability for the resize handle — the separator is currently non-focusable, which is valid ARIA for a plain divider, but arrow-key resizing would be a nice follow-up.
  • Persisting the panel height across navigation.
  • Touch/pointer-event support (currently mouse-only).

jalenevans added 2 commits August 4, 2026 10:33
Users can now resize the TLC output panel vertically by dragging
the handle at its top edge, with height clamped between sensible
bounds and restored on re-expansion. The ResizableDivider now
exposes onDrag callbacks and accessibility attributes.

Closes tlaplus#12
Restore top border when collapsed (hidden resize handle caused visual
gap), re-clamp dragged height on window resize to prevent editor
squeeze, end drag on blur with cleanup, make aria-label optional, and
add 4 regression tests.

Refs tlaplus#12
@lemmy
lemmy requested a review from Copilot August 4, 2026 17:31
@lemmy lemmy added the enhancement New feature or request label Aug 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the TLC Output panel vertically drag-resizable so users can expand it to see more output without being constrained to a small fixed-height box, aligning with the UX request in #12.

Changes:

  • Replace Tailwind fixed heights in TlcOutputPanel with a remembered pixel height that can be adjusted via a vertical ResizableDivider, with clamping and resize re-clamping.
  • Enhance ResizableDivider with drag lifecycle callbacks and improved ARIA semantics (role="separator", aria-orientation, aria-label) and end-drag-on-window-blur behavior.
  • Add a new test suite covering resize math, clamps, collapse/restore behavior, and blur-ending-drag.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/components/TlcOutputPanel.tsx Implements resizable open height state, clamping, and drag UX (no transition during drag).
src/components/ResizableDivider.tsx Adds optional drag callbacks, ARIA attributes, and blur-to-end-drag to improve robustness.
tests/TlcOutputPanel.test.tsx Adds unit tests covering the new resize behavior and edge cases.

Comment thread src/components/ResizableDivider.tsx
JalenEvans and others added 3 commits August 4, 2026 13:51
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@JalenEvans

Copy link
Copy Markdown
Contributor Author

It seems like the build was failing because Node 20 is being deprecated. Upgraded ci and cd to Node 24 to resolve that issue.

@lemmy

lemmy commented Aug 4, 2026

Copy link
Copy Markdown
Member

@FedericoPonzi The build failure seems to be an unrelated infrastructure issue. Could you please help?

@FedericoPonzi

Copy link
Copy Markdown
Collaborator

Thanks for the PR @JalenEvans !

@lemmy it looks like we need to provide write permissions to gh actions to allow the integration to upload the zip with the website preview: https://github.com/tlaplus/tla-by-example/settings/actions
image
but I cannot change it for some reason.
It's not a blocker for merge, I'll quickly checkout the branch and test locally and see how it looks like.

@FedericoPonzi
FedericoPonzi merged commit 3d76dc3 into tlaplus:main Aug 5, 2026
1 of 2 checks passed
@lemmy

lemmy commented Aug 5, 2026

Copy link
Copy Markdown
Member

I’m also unable to change the workflow permissions. Perhaps it’s a policy enforced at the enterprise (Linux Foundation) level.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expandable Output

4 participants