vue-multiselect icon indicating copy to clipboard operation
vue-multiselect copied to clipboard

Setting alllow-empty=false still shows "press enter to remove" label & style

Open danielHalan opened this issue 5 years ago • 3 comments

Reproduction Link

https://jsfiddle.net/to40pq2v/

Steps to reproduce

set alllow-empty = false on a non-multi-select

Expected behaviour

When mouse over "selected" value, don't show "click to remove" and remove-styling, as the item will not be removed (rightly so)

  • Expected same style as any other item, or possibly "lighter" shade of select-color indicating it is already selected.

Actual behaviour

Showing 'press enter to remove' and red-styling.

danielHalan avatar Sep 04 '18 05:09 danielHalan

I don't know if one of the current pull requests handles this already, but I think the following should fix this issue:

Really quick and simplified pseudo solution:

{
  computed: {
    removeDisabled() {
      return this.allowEmpty && (!this.multiple || this.value.length <= 1) 
    }
  }
}
<div ... :class="{'multiselect__option--highlight': currentLogic && !removeDisabled}" .../>

sylann avatar Mar 22 '19 11:03 sylann

I am still facing this. Is it not fixed still? version - 2.1.6

abhic91 avatar Feb 09 '22 05:02 abhic91

Was able to workaround this problem with the deselect-label prop.

<VueMultiselect
  :allow-empty="false"
  deselect-label="Selected"
  :options="['Option 1', 'Second Option', 'Option Three']"
  >
</VueMultiselect>

image

At that stage, it's a matter of reskinning that red bit...

.multiselect__option--selected.multiselect__option--highlight[data-deselect="Selected"] { background:#f3f3f3; color:unset;
  &:after { background:unset; color:unset; }
}

image

AhoyLemon avatar Sep 12 '23 17:09 AhoyLemon