fix(number-input): prevent control overflow when Label is used - #10928
Open
waterWang wants to merge 1 commit into
Open
fix(number-input): prevent control overflow when Label is used#10928waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
The NumberInput.Control was positioned at the top of the root and spanned the full root height via `calc(100% - 2px)`. When a NumberInput.Label was added inside the root, the control extended into the label area. Fix: Remove explicit `top: "0"` so the control uses its static position (after the input in the normal flow). Change height from `calc(100% - 2px)` to `var(--input-height)` — the control now matches the input height instead of the full root height. Add `--input-height` to the root slot in size variants so the control can inherit this CSS variable. Closes chakra-ui#10889
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: ce00f46 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Summary
Fixes the layout issue where
NumberInput.Controloverflows whenNumberInput.Labelis used insideNumberInput.Root.Before
The
NumberInput.Controlwas:top: "0"of the rootheight: "calc(100% - 2px)"When a
NumberInput.Labelwas added as a child of the root, the root's height increased to accommodate the label, causing the control to extend upward into the label area.After
top: "0"so the control uses its static position (right after the input in the normal flow)calc(100% - 2px)tovar(--input-height)— the control now matches the input height instead of the full root height--input-heightto therootslot in the size variants so the control can inherit this CSS variableVerification
pnpm --filter=@chakra-ui/react typecheckpassespnpm --filter=@chakra-ui/react test runpassesnumber-input-with-labelstory that reproduces the original issueCloses #10889