Skip to content

Commit

Permalink
fix(datetime): selecting time now works correctly on firefox (#23583)
Browse files Browse the repository at this point in the history
resolves #23545
  • Loading branch information
liamdebeasi authored Jul 6, 2021
1 parent 8f172de commit 4188964
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/src/components/datetime/datetime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 4188964

Please sign in to comment.