-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(input): fixed a sliding issue caused by the helper wrapper #3966
fix(input): fixed a sliding issue caused by the helper wrapper #3966
Conversation
🦋 Changeset detectedLatest commit: 1e3014a The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 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 |
@mstfblci is attempting to deploy a commit to the NextUI Inc Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe pull request introduces modifications to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
packages/components/input/src/input.tsx
(1 hunks)packages/components/input/src/textarea.tsx
(1 hunks)packages/components/select/src/select.tsx
(1 hunks)
🔇 Additional comments (4)
packages/components/input/src/input.tsx (2)
46-46
: LGTM: Fixed helper wrapper sliding issue
The new condition !((isInvalid && errorMessage) || description)
correctly prevents the helper wrapper from being created when isInvalid
is false but errorMessage
exists, resolving the sliding issue.
51-54
: Verify error message visibility behavior
The rendering logic looks correct, but let's verify that error messages are only visible when intended.
✅ Verification successful
Let me analyze the error message visibility behavior across the input components based on the search results.
The search reveals that error messages are consistently handled in both Input and Textarea components:
-
In input.tsx (the file under review):
- Error message is shown only when
isInvalid && errorMessage
is true - Otherwise, it shows the description
- Error message is shown only when
-
In textarea.tsx:
- Same conditional logic:
isInvalid && errorMessage
- Identical fallback to description
- Same conditional logic:
-
In use-input.ts:
- Error message is derived from props or validation errors
- Proper className handling for error message styling
Error message visibility logic is consistent and correct
The error message rendering behavior is properly implemented with consistent visibility conditions across input components. The message only appears when the input is invalid and an error message is provided.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any other error message rendering logic in Input components
# that might conflict with this change
# Search for error message rendering patterns in input-related files
rg -A 3 'errorMessage.*\?' packages/components/input/
Length of output: 1911
packages/components/select/src/select.tsx (1)
Line range hint 68-75
: Verify memoization of helper getter functions.
The helper wrapper's useMemo dependencies include several getter functions. To optimize performance, these functions should be memoized in the useSelect
hook.
Let's verify the memoization of these functions:
packages/components/input/src/textarea.tsx (1)
146-154
: LGTM! The helper wrapper logic has been improved.
The updated conditional rendering logic effectively addresses the sliding issue by ensuring the helper wrapper is only created when necessary. The new implementation properly handles these cases:
- Shows error message when both
isInvalid
is true anderrorMessage
exists - Shows description when available and no error state exists
- Prevents wrapper creation when conditions aren't met, fixing the sliding issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- please add a changeset
- please provide a before and after screenshots
@wingkwong This removes extra spacing by skipping the helper-wrapper div when it’s not needed. beforeafter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
.changeset/empty-helper-wrapper-div.md (1)
1-6
: Enhance the changeset description to better document the bug fix.While the technical changes are documented, the description could be more comprehensive by including:
- The specific sliding issue that was fixed
- The user-facing impact of these changes
- The conditions that triggered the bug
Consider updating the description to something like:
--- "@nextui-org/select": patch "@nextui-org/input": patch --- - Fixed a UI sliding issue caused by the helper wrapper being rendered when `isInvalid` was false but `errorMessage` was present - Added proper conditions for `isInvalid`, `errorMessage`, and `description` states to prevent unnecessary helper wrapper rendering - Improved the components' stability by ensuring helper text only appears when relevant information is available
Did you verify the changes? @wingkwong |
not yet. you will see the comments here when I do. |
Thank you! @mstfblci it will be available in the next beta version |
a2d6531
into
nextui-org:beta/release-next
Closes #
📝 Description
If isInvalid was false but errorMessage was filled, helper-wrapper was created and a sliding problem was experienced. This was prevented by updating the conditions.
⛳️ Current behavior (updates)
🚀 New behavior
💣 Is this a breaking change (Yes/No):
📝 Additional Information
Summary by CodeRabbit
New Features
Bug Fixes
Documentation