Skip to content

Keep a hand-made node's own position when it takes a form - #1508

Merged
milanb17 merged 1 commit into
mainfrom
mb/node-forms-keep-position
Nov 4, 2026
Merged

milanb17 merged 1 commit into
mainfrom
mb/node-forms-keep-position

Conversation

@milanb17

@milanb17 milanb17 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Since #1498, a hand-made animation whose wb-node elements are placed absolutely and take a data-form draws every node in normal flow: the nodes stack and overlap, and the SVG arrows drawn at fixed coordinates point at empty space. animation.md invites data-form on a wb-node in a hand-made layout, so this is the documented use.

The cause is the kit's :is(.wb-card, .wb-node)[data-form] { position: relative; }, which weighs two classes (0,2,0) and beats an agent's .node { position: absolute } (0,1,0).

The fix

The form, change, outline and colour rules in animation-stage-kit.ts now match through :where(.wb-card, .wb-node)[…], so they weigh one class:

  • They tie with the base .wb-card, .wb-node rule and win by coming after it, so a form's padding, radius and ::before/::after still draw when the agent sets nothing.
  • An animation's own CSS comes after the kit (it is in the body, the kit in the head), so any single-class rule an agent writes wins.
  • The change marks move with them, so the kit keeps its order among these rules: a colour still sets the border after a change stripe, as before.
  • Tones and highlights keep their two-class weight and still take over during a frame.

The scene's own cards are unchanged. .wb-scene > .wb-card keeps them relative, and the legend glyphs have their own two-class rule. The resting frames of request-across-layers and cache-fill-evict (window, bars, cylinder, drum, change stripe, legend) are byte-identical before and after.

Test

blocks.browser.test.tsx adds a 720×420 .architecture layout with two node wb-node cards (data-form="bars") at #a{left:12px;top:10px} and #b{left:262px;top:162px}. The stage reports through the code slot's width whether both kept their position. The test fails on main and passes with the fix.

The stage kit gave every card and node with a data-form
`position: relative` through `:is(.wb-card, .wb-node)[data-form]`, which
weighs two classes. An agent's `.node { position: absolute }` weighs one,
so in a hand-made layout every node with a form fell back into normal
flow: the nodes stacked and the arrows drawn at fixed coordinates pointed
at nothing.

The form, change, outline and colour rules now match through `:where()`,
so they weigh one class, as the base card rule does. They still beat that
rule by coming after it, and an animation's own CSS comes after the kit
and wins. Tones and highlights keep their weight and still take over. The
scene's cards are unchanged: `.wb-scene > .wb-card` keeps them relative.

Agent-Session: cbacb871-2558-4fe4-9272-77524bb21683
Agent-Session: ffed49d6-ca86-4940-b93c-e8eb7e0de440
Agent-Session: d7e3a290-82a4-4f66-9b3c-7a52a51add18
Agent-Session: dd060ef0-ff50-449e-a1a7-c2151a3d0d60
@milanb17
milanb17 merged commit 720edaf into main Nov 4, 2026
3 checks passed
@milanb17
milanb17 deleted the mb/node-forms-keep-position branch November 4, 2026 06:28
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