MDL-69107 form_autocomplete: Rewrite item selection
authorAndrew Nicols <andrew@nicols.co.uk>
Mon, 15 Jun 2020 01:44:39 +0000 (09:44 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 15 Dec 2020 01:08:05 +0000 (09:08 +0800)
commitf07d3b71d288d688152d8e1ca2e3f2a6778c329b
treeea8d7a9eb0ad96d4418eee005b7c505131579399
parentc307f3b1384a03081ef6e16f42e9bdc1b8964ba4
MDL-69107 form_autocomplete: Rewrite item selection

The form_autocomplete is essentially a custom element. Unfortunately the
`setValue()` function in Mink has undesired actions so it is necessary
to write our own handling for it.

The standard Mink `setValue()` function focuses the element, sets a
value, and then blurs the element. In the case of the autocomplete this
can cause the autocomplete suggestions list to be closed in some
situations. Instead of using the setValue we click, and type the value,
but do not immediately blur.
lib/amd/build/form-autocomplete.min.js
lib/amd/build/form-autocomplete.min.js.map
lib/amd/src/form-autocomplete.js
lib/behat/behat_field_manager.php
lib/behat/form_field/behat_form_autocomplete.php
lib/templates/form_autocomplete_input.mustache
lib/tests/behat/behat_forms.php