Skip to content

fix(VListItemAction): adjust inline margins for non-default density#22715

Open
mixelburg wants to merge 1 commit intovuetifyjs:masterfrom
mixelburg:fix/list-item-action-density-margins
Open

fix(VListItemAction): adjust inline margins for non-default density#22715
mixelburg wants to merge 1 commit intovuetifyjs:masterfrom
mixelburg:fix/list-item-action-density-margins

Conversation

@mixelburg
Copy link
Copy Markdown
Contributor

Summary

Closes #22686

When VList has density="comfortable" or density="compact", the VCheckboxBtn (and other VSelectionControl-based components) inside a VListItemAction become smaller. However, VListItemAction had fixed inline margins that were calculated for the default 40 px selection-control size, causing visual misalignment with VListSubheader text.

Root cause

The icon inside VSelectionControl is always 24 px. To keep the icon visually aligned with the list's inline padding, the start margin of VListItemAction--start must equal (selection-control-size - 24px) / 2:

Density Control size Required margin
default 40 px 8 px
comfortable 36 px 6 px
compact 28 px 2 px

Changes

  • packages/vuetify/src/components/VList/_variables.scss — adds a new $list-item-action-margin-density map with the per-density margin values (overridable via user SASS variables).
  • packages/vuetify/src/components/VList/VListItem.sass — iterates the map at @at-root to emit .v-list-item--density-* rules that override the default action margins.

The default entry in the new map reproduces the existing 8 px margins, so there is no visual change at default density.

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-*.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report][4.0.1] Checkbox buttons in non-default density VList are misaligned

1 participant