alsoscotland / react-super-select

MIT License
95 stars 33 forks source link

Append element #99

Closed eduardobarbiero closed 7 years ago

eduardobarbiero commented 7 years ago

Hello People, Is it possible to create a last element with a non-selectable option but an action? Ex: capturar

Thanks.

alsoscotland commented 7 years ago

@eduardobarbiero at the moment the only way to do something like this would be to leverage the custom option templating and do something hacky. You would basically have to append a bogus option item to your data list, and switch the behavior of your template function's output for the link option

eduardobarbiero commented 7 years ago

Thanks @alsoscotland

So if it is not possible to implement in this way, i believe that preventing the click on the object is also not possible, correct?

alsoscotland commented 7 years ago

@eduardobarbiero I think you could, for example, make the action item a button, and arrest the event/stop propagation on the event after your button's action handler.

I may investigate a feature to add a footer/header to the dropdown for these types of use cases. Adding non-option items goes a little against the standard paradigm of an html select control. It'll take a little time to investigate the implications for keyboard accessibility

alsoscotland commented 7 years ago

@eduardobarbiero I have decided not to implement this at this time because adding actionable elements which are not select options goes a bit against the select-control's normal paradigm