fix(StepGroup): correct icon-label alignment for first item in nested StepGroup#3337
fix(StepGroup): correct icon-label alignment for first item in nested StepGroup#3337rzp-slash[bot] wants to merge 4 commits intomasterfrom
Conversation
… StepGroup The first item in a nested StepGroup (StepLineStart / StepLineSingleItem) was placing the marker icon ~6px higher than the label text. Root cause: both components applied marginTop=markerTopAlignment (-13px for medium/solid) on the marker box after a StepTopCurveVertical SVG (14px solid, 20px dotted). This put the marker top at 1px, while StepLineVertical / StepLineEnd use a plain 6px spacer — causing a consistent 5-6px upward shift of the icon relative to the text. Fix: compute correctedMarkerTopAlignment = itemTopMargin - curveHeight solid (14px): 6 - 14 = -8px → marker top = 6px ✅ dotted (20px): 6 - 20 = -14px → marker top = 6px ✅ All other step types (StepLineVertical, StepLineEnd, StepLineHorizontal) and tokens.ts are untouched.
…l alignment - Snapshot tests for solid-curve, dotted-curve, single-item nested, and large-size scenarios - Style tests that assert marginTop=-8px (solid) and -14px (dotted) on the marker box - Guard test that middle nested items (StepLineVertical) are not regressed
|
|
✅ PR title follows Conventional Commits specification. |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 3a1602e:
|
Problem
The icon and label are misaligned for the first item in a nested
StepGroup. The icon appears ~6px above the label text.Reported in: Slack (channel CMQ3RBHEU)
Root Cause
StepLineStart(used forstepType = 'start'— the first item in any nestedStepGroup) renders a flex column:markerTopAlignment = -13pxwas designed to overlap the curve endpoint with the marker center. But this puts the marker top at 1px from the container, while every other step type (StepLineVertical,StepLineEnd) uses a plain6pxspacer. Since the content column's text padding (paddingY: spacing.3) is fixed across all step types, the result is:StepLineStart(bug)StepLineVerticalThe same bug exists in
StepLineSingleItem(nested group with exactly one item).Fix
Compute
correctedMarkerTopAlignment = itemTopMargin - curveHeightso the marker top always lands atitemTopMargin = 6pxfrom the container, consistent with all other step types.-13 px-8 px-13 px-14 pxChanged files:
packages/blade/src/components/StepGroup/StepLine.web.tsx—StepLineStart+StepLineSingleItempackages/blade/src/components/StepGroup/__tests__/StepGroup.web.test.tsx— regression testsUnchanged:
tokens.ts,StepLineVertical,StepLineEnd,StepLineHorizontalBefore / After
Tests Added
stepProgress=none)StepLineSingleItem)marginTop = -8pxon solid-curve marker boxmarginTop = -14pxon dotted-curve marker boxStepLineVertical) are NOT regressedEdge Case Audit
StepLineStartsolid, mediumStepLineStartdotted, mediumStepLineStartsolid, largeStepLineSingleItemsolid, mediumStepLineVertical(middle / default)StepLineEnd(last nested)StepGroup