Skip to content
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(VSelect): correct chips spacing for compact and comfortable #15770

Merged

Conversation

patrickclerc
Copy link
Contributor

Description

Adapt the SASS bottom margin of the select's chips for compact (3px) and comfortable density (2px) in order to avoid the chip and select underline collision.

Motivation and Context

Visually the chips in select field with density compact and comfortable are hoverred by the underline of the select which is not nice.

fixes #15686

How Has This Been Tested?

Visually tested using the below playground.

Markup:

<template>
  <v-app>
    <v-container>
      <v-row>
        <v-col cols="4">
          <h2>Density : compact</h2>
        </v-col>
        <v-col cols="4">
          <h2>Density : comfortable</h2>
        </v-col>
        <v-col cols="4">
          <h2>Density : default</h2>
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            chips
            density="compact"
            label="Standard variant"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            chips
            density="comfortable"
            label="Standard variant"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            chips
            label="Standard variant"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            density="compact"
            label="Plain variant"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            density="comfortable"
            label="Plain variant"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            label="Plain variant"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            density="compact"
            variant="outlined"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            density="comfortable"
            variant="outlined"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            variant="outlined"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            density="compact"
            variant="underlined"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            density="comfortable"
            variant="underlined"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            variant="underlined"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            density="compact"
            variant="solo"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            density="comfortable"
            variant="solo"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            variant="solo"
          />
        </v-col>
      </v-row>
    </v-container>
  </v-app>
</template>

<script>
  export default {
    name: 'Playground',
    data () {
      return {
        slider: 10,
        items: ['Foo', 'Bar', 'Fizz', 'Buzz'],
        selected: 'Foo',
      }
    },
  }
</script>

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any features but makes things better)

Checklist:

  • The PR title is no longer than 64 characters.
  • The PR is submitted to the correct branch (master for bug fixes and documentation updates, dev for new features and backwards compatible changes and next for non-backwards compatible changes).
  • My code follows the code style of this project.
  • I've added relevant changes to the documentation (applies to new features and breaking changes in core library)

Copy link
Member

@johnleider johnleider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VFileInput needs this updated as well. In addition, make sure you check VAutocomplete and VCombobox since they both use VSelect as a base composable.

packages/vuetify/src/components/VSelect/_variables.scss Outdated Show resolved Hide resolved
packages/vuetify/src/components/VSelect/VSelect.sass Outdated Show resolved Hide resolved
Use integer for density intervals in sass
fixes vuetifyjs#15686
Add top and bottom margins for chips when used with compact or
comfortable density.
fixes vuetifyjs#15686
@patrickclerc
Copy link
Contributor Author

patrickclerc commented Oct 5, 2022

VFileInput needs this updated as well. In addition, make sure you check VAutocomplete and VCombobox since they both use VSelect as a base composable.

Here is the new playground to check VSelect, VFileInput, VAutocomplete and VCombobox, one can note that the correction on VSelect doesn't apply to VAutocomplete and VCombobox. I need to adapt these two components also.

Details
<template>
  <v-app>
    <v-container>
      <h1>VSelect</h1>
      <v-row>
        <v-col cols="4">
          <h2>Density : compact</h2>
        </v-col>
        <v-col cols="4">
          <h2>Density : comfortable</h2>
        </v-col>
        <v-col cols="4">
          <h2>Density : default</h2>
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            chips
            density="compact"
            label="Standard variant"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            chips
            density="comfortable"
            label="Standard variant"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            chips
            label="Standard variant"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            density="compact"
            label="Plain variant"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            density="comfortable"
            label="Plain variant"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            label="Plain variant"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            density="compact"
            variant="outlined"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            density="comfortable"
            variant="outlined"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            variant="outlined"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            density="compact"
            variant="underlined"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            density="comfortable"
            variant="underlined"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            variant="underlined"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            density="compact"
            variant="solo"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            density="comfortable"
            variant="solo"
          />
        </v-col>
        <v-col cols="4">
          <v-select
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            variant="solo"
          />
        </v-col>
      </v-row>
    </v-container>
    <v-container>
      <h1>VCombobox</h1>
      <v-row>
        <v-col cols="4">
          <h2>Density : compact</h2>
        </v-col>
        <v-col cols="4">
          <h2>Density : comfortable</h2>
        </v-col>
        <v-col cols="4">
          <h2>Density : default</h2>
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            chips
            density="compact"
            label="Standard variant"
          />
        </v-col>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            chips
            density="comfortable"
            label="Standard variant"
          />
        </v-col>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            chips
            label="Standard variant"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            density="compact"
            label="Plain variant"
          />
        </v-col>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            density="comfortable"
            label="Plain variant"
          />
        </v-col>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            label="Plain variant"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            density="compact"
            variant="outlined"
          />
        </v-col>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            density="comfortable"
            variant="outlined"
          />
        </v-col>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            variant="outlined"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            density="compact"
            variant="underlined"
          />
        </v-col>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            density="comfortable"
            variant="underlined"
          />
        </v-col>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            variant="underlined"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            density="compact"
            variant="solo"
          />
        </v-col>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            density="comfortable"
            variant="solo"
          />
        </v-col>
        <v-col cols="4">
          <v-combobox
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            variant="solo"
          />
        </v-col>
      </v-row>
    </v-container>
    <v-container>
      <h1>VAutocomplete</h1>
      <v-row>
        <v-col cols="4">
          <h2>Density : compact</h2>
        </v-col>
        <v-col cols="4">
          <h2>Density : comfortable</h2>
        </v-col>
        <v-col cols="4">
          <h2>Density : default</h2>
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            chips
            density="compact"
            label="Standard variant"
          />
        </v-col>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            chips
            density="comfortable"
            label="Standard variant"
          />
        </v-col>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            chips
            label="Standard variant"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            density="compact"
            label="Plain variant"
          />
        </v-col>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            density="comfortable"
            label="Plain variant"
          />
        </v-col>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            variant="plain"
            chips
            label="Plain variant"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            density="compact"
            variant="outlined"
          />
        </v-col>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            density="comfortable"
            variant="outlined"
          />
        </v-col>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            label="Outlined variant"
            chips
            variant="outlined"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            density="compact"
            variant="underlined"
          />
        </v-col>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            density="comfortable"
            variant="underlined"
          />
        </v-col>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            label="Underlined variant"
            chips
            variant="underlined"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            density="compact"
            variant="solo"
          />
        </v-col>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            density="comfortable"
            variant="solo"
          />
        </v-col>
        <v-col cols="4">
          <v-autocomplete
            :model-value="selected"
            :items="items"
            label="Solo variant"
            chips
            variant="solo"
          />
        </v-col>
      </v-row>
    </v-container>
    <v-container>
      <h1>VFileInput</h1>
      <v-row>
        <v-col cols="4">
          <h2>Density : compact</h2>
        </v-col>
        <v-col cols="4">
          <h2>Density : comfortable</h2>
        </v-col>
        <v-col cols="4">
          <h2>Density : default</h2>
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            chips
            density="compact"
            label="Standard variant"
          />
        </v-col>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            chips
            density="comfortable"
            label="Standard variant"
          />
        </v-col>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            chips
            label="Standard variant"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            variant="plain"
            chips
            density="compact"
            label="Plain variant"
          />
        </v-col>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            variant="plain"
            chips
            density="comfortable"
            label="Plain variant"
          />
        </v-col>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            variant="plain"
            chips
            label="Plain variant"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            label="Outlined variant"
            chips
            density="compact"
            variant="outlined"
          />
        </v-col>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            label="Outlined variant"
            chips
            density="comfortable"
            variant="outlined"
          />
        </v-col>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            label="Outlined variant"
            chips
            variant="outlined"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            label="Underlined variant"
            chips
            density="compact"
            variant="underlined"
          />
        </v-col>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            label="Underlined variant"
            chips
            density="comfortable"
            variant="underlined"
          />
        </v-col>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            label="Underlined variant"
            chips
            variant="underlined"
          />
        </v-col>
      </v-row>
      <v-row>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            label="Solo variant"
            chips
            density="compact"
            variant="solo"
          />
        </v-col>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            label="Solo variant"
            chips
            density="comfortable"
            variant="solo"
          />
        </v-col>
        <v-col cols="4">
          <v-file-input
            :model-value="fileInput"
            label="Solo variant"
            chips
            variant="solo"
          />
        </v-col>
      </v-row>
    </v-container>
  </v-app>
</template>

<script>
  export default {
    name: 'Playground',
    data () {
      return {
        slider: 10,
        items: ['Foo', 'Bar', 'Fizz', 'Buzz'],
        selected: 'Foo',
        fileInput: [new File([''], 'filename.txt')],
      }
    },
  }
</script>

Add top and bottom margins for chips when used with compact or
comfortable density.
fixes vuetifyjs#15686
@patrickclerc
Copy link
Contributor Author

Corrections done for VSelect, VAutocomplete, VCombobox and VFileInput. The results are shown in the below images :

image
image
image
image

patrickclerc and others added 2 commits October 5, 2022 10:32
Add top and bottom margins for chips when used with compact or
comfortable density.
fixes vuetifyjs#15686
@johnleider johnleider added T: bug Functionality that does not work as intended/expected C: VSelect VSelect labels Oct 11, 2022
@johnleider johnleider added this to the v3.0.0-beta milestone Oct 11, 2022
patrickclerc and others added 2 commits October 12, 2022 07:24
Co-authored-by: John Leider <9064066+johnleider@users.noreply.github.com>
@johnleider johnleider merged commit 073eca7 into vuetifyjs:next Oct 13, 2022
@patrickclerc patrickclerc deleted the fix/compact-select-chips-spacing branch October 19, 2022 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VSelect VSelect T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants