From 969e83c2b37ff49a7bf699dad22e4472d2c09532 Mon Sep 17 00:00:00 2001 From: Romain Estievenart Date: Fri, 3 Nov 2023 14:49:20 +0100 Subject: [PATCH] [FIX] website: `AutoCompleteWithPages` doesn't work correctly on Safari. Since we remove jQuery UI[1], the owl component `AutoCompleteWithPages` doesn't work correctly on Safari. When we clicked on the `AutoCompleteWithPages` input the code in the `AutoComplete` component `onFocus` make a selection on the input of the `AutoComplete` component and not on the `AutoCompleteWithPages` input this make a unwanted effect such as blur the clicked input and focus the other input. This commit fixes that. Steps to reproduce: * With Safari, open the `Website` app * Click on `Site` > `Edit Menu` > `Add Menu Item` * You can't type in the url field and if you spam click on its. Sometimes, it produces a browser crashes Links [1]: https://github.com/odoo/odoo/commit/99f5ae32d3ee4a3dcc75e31ad0a88f42d6ce3589 Part-of: odoo/odoo#140979 --- .../autocomplete_with_pages/autocomplete_with_pages.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/website/static/src/components/autocomplete_with_pages/autocomplete_with_pages.js b/addons/website/static/src/components/autocomplete_with_pages/autocomplete_with_pages.js index 670abc412dd..75446879224 100644 --- a/addons/website/static/src/components/autocomplete_with_pages/autocomplete_with_pages.js +++ b/addons/website/static/src/components/autocomplete_with_pages/autocomplete_with_pages.js @@ -137,6 +137,14 @@ export class AutoCompleteWithPages extends AutoComplete { } } + /** + * @override + */ + onInputFocus(ev) { + this.targetDropdown.setSelectionRange(0, this.targetDropdown.value.length); + this.props.onFocus(ev); + } + /** * @override */