Always hide remove button if no value is selected (#744)

In some cases, the remove item X button is not hidden when there is no
selection made from the dropdown. This is not as usable, since there's
no item to clear, hence an effective noop.

The condition I saw seeing this issue arise is in single selects with
a placeholder value, a selection has been made, and then cleared: the
button HTML remains.

To fix, add some styles to hide the button if the select doesn't have a
value selected, in this case keying off of it's parents `data-value`
property.

fixes #684
This commit is contained in:
Chris DeLuca 2019-11-12 07:29:34 -05:00 committed by Josh Johnson
parent 8775bacdd9
commit f745be449d
3 changed files with 8 additions and 1 deletions

View File

@ -72,6 +72,10 @@
box-shadow: 0px 0px 0px 2px #00bcd4;
}
.choices[data-type*='select-one'] .choices__item[data-value=''] .choices__button {
display: none;
}
.choices[data-type*='select-one']:after {
content: '';
height: 0;

File diff suppressed because one or more lines are too long

View File

@ -83,6 +83,9 @@ $choices-icon-cross-inverse: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiI
box-shadow: 0px 0px 0px 2px $choices-highlight-color;
}
}
.#{$choices-selector}__item[data-value=''] .#{$choices-selector}__button {
display: none;
}
&:after {
content: '';
height: 0;