slim-select icon indicating copy to clipboard operation
slim-select copied to clipboard

X button does not hide on deselect

Open scf37 opened this issue 5 years ago • 7 comments

Describe the bug select with allowDeselect=true does not hide X button on click because this.main.selected() returns undefined instead of ''

Screenshots image

scf37 avatar Nov 04 '20 19:11 scf37

Not sure i 100% follow. Can you paste a copy of the code your using and a screen shot please.

brianvoe avatar Nov 04 '20 19:11 brianvoe

https://jsfiddle.net/uta364yf/15/

X button should not appear.

scf37 avatar Nov 04 '20 20:11 scf37

I believe the cause is that value is kind of required after latest changes but fake placeholder data object does not contain it.

Adding value: '' to lines like var value = { text: '', placeholder: this.main.config.placeholderText}; seems to fix this issue.

scf37 avatar Nov 04 '20 20:11 scf37

Are you saying that if nothing is selected the X button shouldnt show?

brianvoe avatar Nov 04 '20 20:11 brianvoe

Yes, at least that's how it is used to work. Look at the code above - it hides deselect button if nothing selected.

scf37 avatar Nov 04 '20 20:11 scf37

Found a fix: https://jsfiddle.net/4yvnupqc/1/ So it is probably documentation issue (or me misreading documentation)

scf37 avatar Nov 04 '20 21:11 scf37

Ok fair enough. I agree with what your pointing out. If you do a quick pr ill try to get it into the next release

brianvoe avatar Nov 04 '20 21:11 brianvoe

New version of slim select has been released. If this is still an issue let me know and ill try to take care of it.

brianvoe avatar Nov 21 '22 01:11 brianvoe