-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
fix(VField): do not reserve empty space for clear icon #21567
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
base: dev
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR updates the VField component to stop reserving space for the clear icon and instead animate its width on hover or focus.
- Removes
hasClear
from thehasAppend
calculation in VField.tsx - Introduces max-width transitions and transform-based positioning for the clear icon in VField.sass
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
packages/vuetify/src/components/VField/VField.tsx | Stop treating clear button as an appended icon placeholder |
packages/vuetify/src/components/VField/VField.sass | Add max-width transitions and transform logic for clear icon |
Comments suppressed due to low confidence (1)
packages/vuetify/src/components/VField/VField.tsx:224
- [nitpick] The name
hasAppend
is now specific to the append icon and no longer covers the clear button. Renaming it to something likehasAppendIcon
would make its purpose clearer.
const hasAppend = !!(slots['append-inner'] || props.appendInnerIcon)
transition-property: opacity, transform, max-width, margin | ||
display: flex | ||
justify-content: end | ||
transform: translateX(calc(-0.5 * var(--v-field-padding-end) - #{$field-clearable-margin})) |
Copilot
AI
Jun 12, 2025
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.
The use of translateX
here won’t auto-flip in RTL mode, causing the clear icon to animate in the wrong direction. Consider using a logical property or adjusting the transform based on the dir
attribute to preserve correct behavior in RTL layouts.
transform: translateX(calc(-0.5 * var(--v-field-padding-end) - #{$field-clearable-margin})) | |
transform: translateX(calc((#{settings.$dir == 'rtl' ? 0.5 : -0.5}) * var(--v-field-padding-end) - #{$field-clearable-margin})) |
Copilot uses AI. Check for mistakes.
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
6331ca7
to
564ccc8
Compare
a7fa817
to
2e2cddb
Compare
Description
Another take on the reserved space for clear icon.
Note1: I am not sure if I like the text shift in the textarea
Note2: we could just drop CSS in favor of JS transition - here is a minor improvement on top of #20474. It would only need (1) detection for
media (hover: none)
and (2) approval for the behavior changefixes #20375
closes #20474
closes #20534
Markup: