diff --git a/CHANGELOG.md b/CHANGELOG.md index 4427357b..fff94041 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Expose the clear action as a button named by `onClearanceText`, and as disabled if the Select is disabled. - Prevent any interaction with the clear action of a disabled Select. - Without `fill`, the wrapper element used for `wrapperProps` and test IDs is displayed inline, like the Select itself. +- `` + - restore the saved height of vertically resized nodes, including sticky notes, while honoring configured resize limits ## [26.2.1] - 2026-11-02 diff --git a/src/extensions/react-flow/nodes/NodeContent.test.tsx b/src/extensions/react-flow/nodes/NodeContent.test.tsx new file mode 100644 index 00000000..71cd9f75 --- /dev/null +++ b/src/extensions/react-flow/nodes/NodeContent.test.tsx @@ -0,0 +1,44 @@ +import React from "react"; +import { render, screen } from "@testing-library/react"; +import { ReactFlowProvider } from "@xyflow/react"; + +import "@testing-library/jest-dom"; + +import { NodeContent } from "./NodeContent"; + +describe("NodeContent vertical sizing", () => { + it.each([ + { savedHeight: 900, maxHeight: undefined, expectedMaxHeight: "none" }, + { savedHeight: 900, maxHeight: 600, expectedMaxHeight: "600px" }, + { savedHeight: undefined, maxHeight: undefined, expectedMaxHeight: "400px" }, + ])( + "applies max-height $expectedMaxHeight with saved height $savedHeight and resize limit $maxHeight", + ({ savedHeight, maxHeight, expectedMaxHeight }) => { + render( + + + + , + ); + + const node = screen.getByTestId("node-content"); + expect(node).toHaveStyle({ maxHeight: expectedMaxHeight }); + if (savedHeight) { + const height = Math.min(savedHeight, maxHeight ?? Infinity); + expect(node).toHaveStyle({ height: `${height}px` }); + expect(node.parentElement).toHaveStyle({ height: `${height}px` }); + } + }, + ); +}); diff --git a/src/extensions/react-flow/nodes/NodeContent.tsx b/src/extensions/react-flow/nodes/NodeContent.tsx index a1e78a82..12cbea94 100644 --- a/src/extensions/react-flow/nodes/NodeContent.tsx +++ b/src/extensions/react-flow/nodes/NodeContent.tsx @@ -535,13 +535,15 @@ export function NodeContent>({ highlightColor, ); + // A saved height must override the default CSS height cap, just as an interactive resize does. + const resizableMaxHeight = resizeMaxDimensions?.height ?? (nodeDimensions?.height ? "none" : undefined); const resizableStyles = isResizable && (width ?? 0) + (height ?? 0) > 0 ? { width, height, maxWidth: resizeDirections.right ? (resizeMaxDimensions?.width ?? undefined) : undefined, - maxHeight: resizeDirections.bottom ? (resizeMaxDimensions?.height ?? undefined) : undefined, + maxHeight: resizeDirections.bottom ? resizableMaxHeight : undefined, } : {};