From ab429a4444a23df5eec35aa2c6acdee113fe9af8 Mon Sep 17 00:00:00 2001 From: MerlinGuillaume Date: Tue, 18 Apr 2023 13:08:33 +0000 Subject: [PATCH] [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) Signed-off-by: Guillaume Merlin (megu) --- addons/web/static/src/core/datepicker/datepicker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/core/datepicker/datepicker.js b/addons/web/static/src/core/datepicker/datepicker.js index a9c3d8a27c3..bb101000db8 100644 --- a/addons/web/static/src/core/datepicker/datepicker.js +++ b/addons/web/static/src/core/datepicker/datepicker.js @@ -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"); } }