New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get mouse position in dragover event #1925

Closed
blacksvk opened this Issue Dec 14, 2014 · 6 comments

Comments

Projects
None yet
5 participants
@blacksvk

blacksvk commented Dec 14, 2014

I cannot get mouse position via e.pageX and e.pageY in dragover event in recent version of jQuery.
However, same code is working in jQuery 1.6.4

Example code: http://jsfiddle.net/blacksvk/qnbc80xy/1/

@markelog markelog added the Event label Dec 18, 2014

@araghava

This comment has been minimized.

Show comment
Hide comment
@araghava

araghava Dec 20, 2014

Contributor

The regex here does not include drag events, which prevents the properties such as pageX and pageY from being coped over here.

Modifying the regex to:

rmouseEvent = /^(?:mouse|pointer|contextmenu|drag)|click/,

might be a potential fix?

Contributor

araghava commented Dec 20, 2014

The regex here does not include drag events, which prevents the properties such as pageX and pageY from being coped over here.

Modifying the regex to:

rmouseEvent = /^(?:mouse|pointer|contextmenu|drag)|click/,

might be a potential fix?

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Dec 23, 2014

Member

I agree this would be an easy fix to get mouse-related properties since DragEvent inherits from MouseEvent. In general we do not support the HTML5 drag/drop special properties directly and you should use event.originalEvent for that, see the discussion in Trac #7808.

Member

dmethvin commented Dec 23, 2014

I agree this would be an easy fix to get mouse-related properties since DragEvent inherits from MouseEvent. In general we do not support the HTML5 drag/drop special properties directly and you should use event.originalEvent for that, see the discussion in Trac #7808.

@dmethvin dmethvin added this to the 3.0.0 milestone Dec 23, 2014

@dmethvin dmethvin added Feature Bug and removed Feature labels Dec 23, 2014

@markelog

This comment has been minimized.

Show comment
Hide comment
@markelog

markelog Dec 23, 2014

Member

So @araghava, @blacksvk would any of you like to send us a PR for it?

Member

markelog commented Dec 23, 2014

So @araghava, @blacksvk would any of you like to send us a PR for it?

@araghava

This comment has been minimized.

Show comment
Hide comment
@araghava

araghava Dec 24, 2014

Contributor

@markelog i'll have a look shortly

Contributor

araghava commented Dec 24, 2014

@markelog i'll have a look shortly

araghava added a commit to araghava/jquery that referenced this issue Dec 27, 2014

araghava added a commit to araghava/jquery that referenced this issue Dec 27, 2014

araghava added a commit to araghava/jquery that referenced this issue Dec 27, 2014

araghava added a commit to araghava/jquery that referenced this issue Dec 27, 2014

@dmethvin dmethvin self-assigned this Jan 5, 2015

dmethvin added a commit that referenced this issue Jan 5, 2015

Event: Normalize mouse event properties in drag events
DragEvent is a superset of MouseEvent, so we want to fix up mouse
properties like pageX and pageY.

Fixes gh-1925
(cherry picked from commit 389b2ab3b93bfd68ca6c6153a43e11d93ab9ec71)

@dmethvin dmethvin closed this in 97cf528 Jan 5, 2015

@gtristan

This comment has been minimized.

Show comment
Hide comment
@gtristan

gtristan Jan 13, 2015

The above patch fixes dragstart,drag,dragend,dragover,dragenter and dragleave

However it does not fix the drop event.

I admit to not being a regexpert, but this adjustment fixes it for me:

rmouseEvent = /^(?:mouse|pointer|contextmenu|drag)|drop|click/,

gtristan commented Jan 13, 2015

The above patch fixes dragstart,drag,dragend,dragover,dragenter and dragleave

However it does not fix the drop event.

I admit to not being a regexpert, but this adjustment fixes it for me:

rmouseEvent = /^(?:mouse|pointer|contextmenu|drag)|drop|click/,
@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Jan 13, 2015

Member

@gtristan thanks for the note, new issue has been created

Member

dmethvin commented Jan 13, 2015

@gtristan thanks for the note, new issue has been created

dmethvin added a commit that referenced this issue Jan 14, 2015

Event: HTML5 drop events inherit from MouseEvent
Fixes gh-2009
Ref gh-1925
(cherry picked from commit d7e5fce)

Conflicts:
	test/unit/event.js

markelog added a commit that referenced this issue Nov 10, 2015

Event: Normalize mouse event properties in drag events
DragEvent is a superset of MouseEvent, so we want to fix up mouse
properties like pageX and pageY.

Fixes gh-1925

@dmethvin dmethvin modified the milestones: 1.12/2.2, 3.0.0 Jan 7, 2016

@cssmagic cssmagic referenced this issue May 18, 2016

Open

jQuery #5

@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.