Open Bug 1187591 Opened 9 years ago Updated 2 years ago

Click events on elements with overflow != visible fire after the mouse is dragged out of the element

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect

Tracking

()

Webcompat Priority P3
Tracking Status
platform-rel --- -

People

(Reporter: arni2033, Unassigned)

References

(Blocks 3 open bugs)

Details

Attachments

(1 file)

Attached file Click event should not fire.htm (deleted) —
STR:
1. Place mouse over dark gray area and press left mouse button.
2. Move mouse outside the dark gray area.
3. Release mouse button.

RESULT: click event fires

EXPECTATIONS: click event fires for element only if I press left mouse button over an element, then maybe move my mouse, then release button over the same element
Component: Untriaged → Event Handling
Product: Firefox → Core
STR, Step 0: Open attachment page.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Has STR: --- → yes
Interesting. If the `overflow-y: auto;` is removed, the issue is no longer reproducible. As soon as there is any overflow value that's not `visible`, dragging the mouse out of the element and releasing the mouse will trigger the click event.
Summary: Sometimes click events fire when they should not. → Click events on elements with overflow != visible fire after the mouse is dragged out of the element
Nomming for platform-rel since this affects a Yandex site (see Bug 1257816).
platform-rel: --- → ?
Whiteboard: [platform-rel-yandex]
platform-rel: ? → +
This is because nsFrame::HandlePress sets CapturingContent.
I wonder how to tweak that.
This is tricky. Chrome for example doesn't seem to capture the mouse while dragging around a scrollable area, yet it still scrolls it.

We could possibly fix this only for cases when there isn't anything to scroll, but keep the scrolling + capturing handling as it is.
Or, hmm, we could have special capturing for the case when nsFrame sets it. Event handling would still work normally, but "HandleDrag" would be forwarded to whatever needs to be possibly scrolled.
Hmm, sounds like this what I worked on bug 552707. When I worked on that, I tried to capture mouse with the selection root. Is the changed behavior expected by this bug?
I'm going to try the approach where we don't use the normal capturing here, but just mark which element's primary frame should get called when doing mousemove. That way DOM events get normal targeting, but drag-selection in scrollable areas should still work.
Yandex enabled a new design that doesn't have this bug.
I don't think it makes sense to list all sites that use said CSS and set platform-rel for each one...
BTW, this bug happens with video element on Youtube, and actually in any <video> with hidden controls.
platform-rel: + → ---
Whiteboard: [platform-rel-yandex]
(In reply to arni2033 from comment #10)
> Yandex enabled a new design that doesn't have this bug.
> I don't think it makes sense to list all sites that use said CSS and set
> platform-rel for each one...
> BTW, this bug happens with video element on Youtube, and actually in any
> <video> with hidden controls.

Please don't remove platform-rel whiteboard tags or tracking status arni2033, they're being used by a number of teams to prioritize work.
platform-rel: --- → +
Whiteboard: [platform-rel-yandex]
Blocks: 1259357
arni2033's profile has since been disabled. Based on Comment 10 — does this still re-produce?
Flags: needinfo?(miket)
Yeah, this still reproduces according to the linked testcase, but apparently not on the Yandex site in question. But, something still worth fixing.
Flags: needinfo?(miket)
platform-rel: + → -
Whiteboard: [platform-rel-yandex]
Component: Event Handling → User events and focus handling
Webcompat Priority: --- → ?

Hi,
Any new updates on this?
The approach mentioned in comment #9 would work but we will have to figure out a case where the mouse is dragged out of the window.

Webcompat Priority: ? → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: