fix(VTextField): hide-details="auto" with counter (#19998)#22620
Open
Yanis-Riani wants to merge 2 commits into
Open
fix(VTextField): hide-details="auto" with counter (#19998)#22620Yanis-Riani wants to merge 2 commits into
Yanis-Riani wants to merge 2 commits into
Conversation
When using hide-details="auto" with the counter prop, the details section was always visible because VInput's auto logic considers slots.details as content to show. VTextField always provides this slot when a counter exists, causing a permanent blank space. Only provide the details slot when the counter is actually active (focused or persistentCounter) or when hideDetails is not "auto". Apply the same fix to VTextarea and VFileInput. resolves vuetifyjs#19998
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.
Description
Fixes #19998
When using
hide-details="auto"with thecounterprop onVTextField,VTextarea, orVFileInput, the.v-input__detailssection remains visible as blank space even when there are no messages and the field is not focused.Root cause
VTextFieldalways providesVInput'sdetailsslot when a counter exists, regardless of whether the counter is actually visible.VCounterhandles its own visibility internally viav-show(through theactiveprop), but the slot function itself is always passed toVInput. SinceVInput'sautologic checks!!slots.detailsto determine if there is content to show, the details section never hides.What this PR does
In
VTextField,VTextarea, andVFileInput, thedetailsslot is now only provided when the counter is actually active or whenhideDetailsis not"auto":Known limitation
This is a partial fix. When
hideDetails="auto"and error messages are already visible, the counter is not in the DOM. Focusing the field mounts the counter fresh instead of transitioning it viav-show. The counter appears instantly rather than sliding in.Toward a complete solution
The root issue is that communication between
VInputand its children is unidirectional. Children can influence theautomode by providing adetailsslot (!!slots.details), and they manage their own content visibility internally (e.g.VCounterusesv-showviaactive). But children have no way to know whetherVInputis already displaying details (e.g. due to error messages). This means a child likeVTextFieldcannot decide to keep its counter in the DOM for transitions while also preventing the blank space inautomode.A complete fix would require bidirectional communication — allowing children to both influence the
autobehavior and react toVInput's details state (e.g. viaprovide/inject). I intentionally kept this PR scoped to avoid potential breaking changes inVInputwithout futher guidance.Markup