I think some behavior of AutocompleteInput that I observed may be due to bugs:
-
I have completions = [‘aaa’, ‘bbb’, ‘ccc’, ‘ddd’] . If I type in ‘aa’ then ‘aaa’ appears in the suggestion list, which is expected. I select ‘aaa’ from the suggestion but ‘aa’ is handed over to the callback, while I belive the natural behavior should be that ‘aaa’ is selcted. Right after this, I re-type ‘aa’ and choose ‘aaa’ from the suggestion list, then now ‘aaa’ is handed over to the callback. No matter what the completions list is, AutocompleteInput accepts the chosen item only at the second time or trial.
-
The suggestion list only shows up when I type at least two letters. Why isn’t one character enough?
Here is a code snippet that I used:
from bokeh.models.widgets import AutocompleteInput
from bokeh.layouts import layout
from bokeh.io import curdoc
values = ['aaa', 'bbb', 'ccc', 'ddd']
choices = AutocompleteInput(completions=values, value = values[0], title='Choose')
def update(new):
print(new)
choices.on_change('value', lambda att, old, new: update(new))
update(choices.value)
l = layout([
[choices],
], sizing_mode='fixed')
curdoc().add_root(l)
curdoc().title = 'UI Test'