[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
This commit is contained in:
Romain Estievenart
2023-11-04 12:21:46 +00:00
parent 45488b9277
commit 969e83c2b3
@@ -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
*/