fix(datetime): selecting time now works correctly on firefox (#23583)

resolves #23545
This commit is contained in:
Liam DeBeasi
2021-07-06 14:27:27 -04:00
committed by GitHub
parent 8f172de355
commit 4188964dc8

View File

@ -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') {