Skip to content

[DS 2.0] Render the default canvas port at the designed 8px - #122

Open
librowski wants to merge 3 commits into
ds2-canvas-edgesfrom
ds2-canvas-ports
Open

librowski wants to merge 3 commits into
ds2-canvas-edgesfrom
ds2-canvas-ports

Conversation

@librowski

@librowski librowski commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

The default port declares content 4px + border 2px per side with box-sizing: content-box, intending an 8px outer size. The base stylesheet of @xyflow/react 12.10.0 imposes min-width: 5px; min-height: 5px on handles; with content-box the minimum applies to the content, so the effective size was 9x9px. Hover (content 12px) was already correct at 16px.

Change

  • handle.module.css: min-width: 0; min-height: 0 on the base handle rule.
  • built-css-pitfalls.md documents the inherited-minimum trap and how to check it by hand. A dist check for the handle geometry was added and then removed in review: it matched every rule ending in .react-flow__handle, so any later state rule on the bare handle would have failed it, and exact-string matching against minified output was fragile.
  • Changeset: @workflowbuilder/ui patch.

Verification

Build, check:built-css (prefixes, root-scoped public variables, imports, asset URLs), ui tests and stylelint pass. Manual browser pass in the demo (Simple Workflow, 30 handles, layout px via offsetWidth): default and connectionindicator 8x8, handle hover 16x16, node hover indicators 16x16, connectingfrom 8x8 with crosshair, top/bottom handle rules only reposition (size unchanged). jsdom cannot measure layout, so the automated part is the built-CSS contract.

Follow-up in this PR: target port while connecting

xyflow assigns connectingto to the closest handle within connectionRadius, so the pointer is often not over the target and :hover cannot express the state; the target needs its own rule. .connectingto.valid shares the .connectingfrom rule: a target accepted by isValidConnection grows to the 16px active port, a rejected one keeps 8px while the connection line reports invalid, other ports stay 8px, drop still creates the edge (verified in the demo with the built package). Design has Default and Hover port states only; design is asked to confirm Hover for the valid target and to say whether an invalid target needs a state of its own. Changeset: @workflowbuilder/ui patch.

@librowski
librowski marked this pull request as draft September 7, 2026 12:07
@librowski
librowski marked this pull request as ready for review September 14, 2026 06:41
Comment thread packages/ui/src/components/node/node-panel/handle.module.css Outdated
Comment thread packages/ui/src/components/node/node-panel/handle.module.css Outdated
Comment thread packages/ui/scripts/check-built-css.ts Outdated
xyflow's 5px minimum applies to the content box and expands the bordered port to 9px.
Reset both minimums so 4px content plus 2px borders remains 8px.
React Flow captures the pointer on the dragged handle, so the node under
the cursor never receives :hover and its ports stayed at the 8px default
during a connection. The connectingto state now shares the connectingfrom
rule, so the target shows the same 16px active port as the source.
…try check

Review follow-up. The connecting-state rule now targets .connectingto.valid,
so a port rejected by isValidConnection keeps its default size while the
connection line reports invalid; the comment explains the real reason the
target needs its own rule (xyflow assigns connectingto by proximity within
connectionRadius, so :hover cannot express it). The built-CSS geometry check
is removed: it matched every rule ending in .react-flow__handle and would
have failed any future state rule on the bare handle, and its exact-string
comparison against minified output was fragile. The pitfalls entry records
the manual check instead.
@librowski
librowski removed this pull request from stack #125 September 15, 2026 10:24
@librowski
librowski added this pull request to stack #151 September 15, 2026 10:24
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.

2 participants