dequelabs / combobo

Accessible combobox
https://dequelabs.github.io/combobo/demo/
MIT License
48 stars 13 forks source link

Option to remove input text selection on click of an input #27

Open JoeDMitchell opened 4 years ago

JoeDMitchell commented 4 years ago

When you click an input it auto selects the text inside of it. This means on mobile a context menu is shown (allowing copy and paste e.t.c) which is very annoying for a user. Can we have an option to disable this text selection?

pimschaaf commented 4 years ago

This is not a solution, but you can blur() the input.

I found that both .on('change') and .on('selection') fire too early though, requiring something like the following as a workaround:

combobo.on('selection', function() {
  setTimeout(function() {
    $('#combobox').blur();
  }, 1);
});

This still allows for a split second of text selection. Also, as it blurs the input, the user will need to tab back to change the selection.