diff options
| author | Alexandre Kühn <aku@odoo.com> | 2020-01-22 09:29:23 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2020-01-30 14:11:06 +0000 |
| commit | 7a691c8eb09bb1a554eefca972ba6d545919d0c7 (patch) | |
| tree | 6744f2ea500787cbaff284850397ac9fc2028b21 /addons/web/static/src/js | |
| parent | 8b9f17ee9025906c1598c47321091bb96a4473b2 (diff) | |
[FIX] web: update search view menu on click IME suggestion menu
Before this commit, when typing something in the search view in
Japanese, and then clicking on a suggestion from the IME dropdown
menu, the search view menu did not update with selection.
Steps to reproduce:
- Enable Japanese IME in hiragana mode;
- Type "test" in search view;
- Soft-select another suggestion item, e.g. "テスト";
- Double-click on suggestion item "test";
=> The search view menu still detects "テスト".
As a result, clicking on any of these search view suggested filters
picks "テスト" instead of "test".
This commit fixes the issue by updating search menu when clicking
in a suggestion in the IME menu.
opw-2061590
closes odoo/odoo#44318
X-original-commit: 0bca4c0883f2b58842da6a8c1a4e26bf2444d5f3
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/widgets/auto_complete.js | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/addons/web/static/src/js/widgets/auto_complete.js b/addons/web/static/src/js/widgets/auto_complete.js index 30c38690d17..fef24527e46 100644 --- a/addons/web/static/src/js/widgets/auto_complete.js +++ b/addons/web/static/src/js/widgets/auto_complete.js @@ -51,14 +51,12 @@ return Widget.extend({ } return; } - var search_string = self.get_search_string(); - if (self.search_string !== search_string) { - if (search_string.length) { - self.search_string = search_string; - self.initiate_search(search_string); - } else { - self.close(); - } + self._updateSearch(); + }); + this.$input.on('input', function (ev) { + if (ev.originalEvent.inputType === 'insertCompositionText') { + // click inside keyboard IME suggestions menu + self._updateSearch(); } }); this.$input.on('keypress', function (ev) { @@ -249,6 +247,22 @@ return Widget.extend({ }, is_expanded: function() { return this.$el[0].style.display === "block"; - } + }, + /** + * Update search dropdown menu based on new input content. + * + * @private + */ + _updateSearch: function () { + var search_string = this.get_search_string(); + if (this.search_string !== search_string) { + if (search_string.length) { + this.search_string = search_string; + this.initiate_search(search_string); + } else { + this.close(); + } + } + }, }); }); |
