fix: mp-3213-center the switch knob on the track when the label wraps - #904
Merged
Merged
Conversation
Collaborator
|
@infante-jaime please post a screenshot of the fixed switch to the description of the PR. |
dyersituations
approved these changes
Sep 14, 2026
roger-in-kiva
approved these changes
Sep 14, 2026
roger-in-kiva
left a comment
Collaborator
There was a problem hiding this comment.
Is there a case with more than 2 lines?
Contributor
Author
Yes — the fix works regardless of the number of lines. The track and knob are both centered against the same row, so they stay aligned at any label height. I also verified it with a 10-line label. The story just uses 2 lines to keep the example simple. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MP-3213 — Center the switch knob when the label wraps
Fixes https://kiva.atlassian.net/browse/MP-3213
At mobile widths, a KvSwitch label that wraps to multiple lines made the
row taller than the track, and the knob — anchored to the top of the row —
drifted off the track.
Changes
tw-top-1/2 -tw-translate-y-1/2)instead of
tw-top-0, so it stays centered on the track at any label height.Forms/KvSwitchSmall story to show the case.Testing
npm run test— all KvSwitch specs pass, including the new centering test.In the Storybook, we deliberately added a second toggle with a short label so that it needs to be centered by the fix.