From 4188964dc8da2c46494245b81864ca6e305611f5 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Tue, 6 Jul 2021 14:27:27 -0400 Subject: [PATCH] fix(datetime): selecting time now works correctly on firefox (#23583) resolves #23545 --- core/src/components/datetime/datetime.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/components/datetime/datetime.tsx b/core/src/components/datetime/datetime.tsx index 2e28491f3a..553948ac15 100644 --- a/core/src/components/datetime/datetime.tsx +++ b/core/src/components/datetime/datetime.tsx @@ -1009,7 +1009,15 @@ export class Datetime implements ComponentInterface { otherCol.classList.remove('time-column-active'); const bbox = activeCol.getBoundingClientRect(); - const activeElement = this.el!.shadowRoot!.elementFromPoint(bbox.x + 1, bbox.y + 1)!; + + /** + * Do not use floating point + * here as some browsers may clamp + * or round down. + */ + const x = Math.ceil(bbox.x + 1); + const y = Math.ceil(bbox.y + 1); + const activeElement = this.el!.shadowRoot!.elementFromPoint(x, y)!; const value = parseInt(activeElement.getAttribute('data-value')!, 10); if (colType === 'hour') {