[FIX] web: keep datepicker open on mobile devices

On some mobile devices (eg Samsung Galaxy S22), the datepicker
immediately closes when trying to apply a custom date filter

Steps to reproduce:
1. Install Sales
2. Open Sales
3. Click on the search icon then on the filter icon
4. Click on 'Filters' and add a custom filter on field creation date
5. Click on one of the dates
6. The datepicker opens and then closes immediately

Solution:
Do not hide the datepicker when a scroll is made on mobile devices

Problem:
When opening the datepicker, the keyboard would show up, scrolling the
view which triggers the closing of the datepicker

opw-3166801

closes odoo/odoo#119682

X-original-commit: bd6ed025fae33ff3b0444d34142e1577a457b77f
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This commit is contained in:
MerlinGuillaume
2023-04-25 21:11:05 +02:00
parent a19d96da7d
commit ab429a4444
@@ -13,7 +13,7 @@ import {
import { getActiveHotkey } from "@web/core/hotkeys/hotkey_service";
import { localization } from "@web/core/l10n/localization";
import { useAutofocus } from "@web/core/utils/hooks";
import { isIOS } from "@web/core/browser/feature_detection";
import { isMobileOS } from "@web/core/browser/feature_detection";
import {
Component,
@@ -247,7 +247,7 @@ export class DatePicker extends Component {
* @param {Event} ev
*/
onWindowScroll(ev) {
if (!isIOS() && ev.target !== this.inputRef.el) {
if (!isMobileOS() && ev.target !== this.inputRef.el) {
this.bootstrapDateTimePicker("hide");
}
}