rjaros / kvision

Object oriented web framework for Kotlin/JS
https://kvision.io
MIT License
1.2k stars 67 forks source link

TomSelect is not searchable when placeholder == null #483

Closed shananton closed 1 year ago

shananton commented 1 year ago

The TomSelectInput component has this line in getSettingsObj():

if (placeholder == null) this.controlInput = null

This disables some built-in TomSelect functionality, including being able to search options, and almost turns it into a simple Select. I'm not sure what's the logic behind this (why should the lack of a placeholder stop the user from being able to search?) and I could not find mentions of this in the docs...

I'd appreciate if you could either fix this or elaborate why it's done as it is (and maybe update the docs) :upside_down_face:

rjaros commented 1 year ago

There were two reasons for this:

  1. TomSelect was designed as a replacement for the old BootstrapSelect component from KVision 5, which had a search option but was not searchable by default.
  2. I had some issues with strange wrapping of TomSelect control on smaller screens, caused by the empty search input. Showing this input only when the placeholder was defined fixed the problem.

I agree these are not very strong arguments and I'm willing to remove this constraint. I'll just add a new disableSearch option to make it explicit.

rjaros commented 1 year ago

Fixed in 6.6.0