Closed Bug 1882903 Opened 9 months ago Closed 8 months ago

MouseEvent offsetX, offsetY return 0 value when accessed outside of event handler stack

Categories

(Core :: DOM: Events, defect)

Firefox 123
defect

Tracking

()

RESOLVED DUPLICATE of bug 1359440

People

(Reporter: st3v0, Unassigned)

Details

Steps to reproduce:

I debounced the mouse event to avoid reflows. And tried to access the offsetX property from the debounced event.
This doc (https://gist.github.com/paulirish/5d52fb081b3570c81e3a) states that offsetX/Y can trigger a reflow.

I've created a codesandbox example to demonstrate the issue:
https://codesandbox.io/p/sandbox/dreamy-sun-xrspkl

Demo: https://xrspkl.csb.app/

Just run the demo in both chrome/firefox and notice that the offset values always return 0 in firefox only.

Actual results:

The mouse event offset values always return 0 in firefox only, when accessed from a deferred callback.

Expected results:

I would expect the offset values to be non-zero and accurately reflect the the current offset x/y. I would also expect it to behave the same across all browsers, currently this is only broken in firefox; chrome, safari & edge all work the same.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Events' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Events
Product: Firefox → Core

What is the expected behavior per spec?

Flags: needinfo?(masayuki)
Severity: -- → S3
Status: UNCONFIRMED → RESOLVED
Closed: 8 months ago
Duplicate of bug: 1359440
Flags: needinfo?(masayuki)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.