fix(VListItemAction): adjust inline margins for non-default density#22715
Open
mixelburg wants to merge 1 commit intovuetifyjs:masterfrom
Open
fix(VListItemAction): adjust inline margins for non-default density#22715mixelburg wants to merge 1 commit intovuetifyjs:masterfrom
mixelburg wants to merge 1 commit intovuetifyjs:masterfrom
Conversation
Fixes vuetifyjs#22686 When VList has density=comfortable or density=compact, VCheckboxBtn (and other VSelectionControl-based components) inside VListItemAction become smaller. However VListItemAction had fixed inline margins that were calculated for the default 40px selection-control size, causing visual misalignment with VListSubheader text. The margins are derived from (selection-control-size - icon-size) / 2: default: (40px - 24px) / 2 = 8px comfortable: (36px - 24px) / 2 = 6px compact: (28px - 24px) / 2 = 2px A new $list-item-action-margin-density map in _variables.scss stores these values and VListItem.sass applies them via .v-list-item--density-*.
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
Closes #22686
When
VListhasdensity="comfortable"ordensity="compact", theVCheckboxBtn(and otherVSelectionControl-based components) inside aVListItemActionbecome smaller. However,VListItemActionhad fixed inline margins that were calculated for the default 40 px selection-control size, causing visual misalignment withVListSubheadertext.Root cause
The icon inside
VSelectionControlis always 24 px. To keep the icon visually aligned with the list's inline padding, the start margin ofVListItemAction--startmust equal(selection-control-size - 24px) / 2:Changes
packages/vuetify/src/components/VList/_variables.scss— adds a new$list-item-action-margin-densitymap with the per-density margin values (overridable via user SASS variables).packages/vuetify/src/components/VList/VListItem.sass— iterates the map at@at-rootto emit.v-list-item--density-*rules that override the default action margins.The
defaultentry in the new map reproduces the existing 8 px margins, so there is no visual change at default density.