-
- Downloads
[FIX] web: handle early option selections in autocomplete
The autocomplete component intercepts certain key presses allowing the end-user
to select an option from the autocomplete dropdown using either the enter or
tab keys. Before this commit those keypresses where only intercepted when the
autcomplete selection list was already completely loaded.
Consider now for example an x2many list where the lines can be selected using
the autocomplete component. To add a line to the list the end-user will usually
type part of the record name and then select it with tab or enter. Three things
can happen:
* The enter keypress is handled after the list of options is fully loaded
* The enter keypress is handled while waiting for the list of options to load
* The enter keypress is handled while still debouncing the input, no request
to load the options has been made so far
The last two cases commonly occur when inputting lines with a barcode scanner
for example. In this case the enter keypress is ignored by the autocomplete
component and is instead handled by the list renderer component. This generally
results in the list renderer trying to create a new line but failing because
of missing required fields in the previous line. This seems more or less
acceptable. However, if required fields are already filled out or not present
in the list view, a new line is created while the current one remains empty.
This behavior is clearly counterintuitive, as such, this commit proposes to
wait for handling tab and enter keypresses while debouncing the input or
loading the list of options.
opw-3235288
closes odoo/odoo#122143
Signed-off-by:
Michaël Mattiello (mcm) <mcm@odoo.com>
Showing
- addons/web/static/src/core/autocomplete/autocomplete.js 36 additions, 12 deletionsaddons/web/static/src/core/autocomplete/autocomplete.js
- addons/web/static/src/core/autocomplete/autocomplete.xml 1 addition, 1 deletionaddons/web/static/src/core/autocomplete/autocomplete.xml
- addons/web/static/tests/views/list_view_tests.js 41 additions, 0 deletionsaddons/web/static/tests/views/list_view_tests.js
Loading
Please register or sign in to comment