#1065 ✓invalid

pointerX and pointerY values for keyboard events

Reported by mMerlin | May 28th, 2010 @ 05:23 AM

I do not know what the complete 'intent' is for the pointerX and pointerY event properties, when used the keyboard related events: keydown, keyup, keypress. What I find though is a discrepancy between the values reported for Firefox and IE.

Working with prototype 1.7 rc2: Web server is XAMPP on Ubuntu, browsers FF 3.6.3 and IE 8.0.6001 on Win XP SP3 over LAN, FF 3.6.3 on Ubuntu localhost. Events created using $(eleId).on() with css selector filter.

In IE those properties are always numeric. In Firefox the values are NaN when the browser [window] is scrolled right to the top left [home location]. As soon as the FF windows is scrolled vertically, pointerY becomes a numeric. As soon as it is scrolled horizontally, pointerX becomes numeric.

Exploring the values returned in IE, it appears the values are the current coordinates of the mouse pointer. I get that conclusion by clicking in a text field, then [without moving the moue] pressing the shift key. The pointerX, pointerY values are the same for the click and key press events. Moving the mouse, and press the shift key again give new coordinates, based on the mouse position. I can actually get negative values with the mouse pointer at the left or top edge of the [web page] display area, with the mouse well outside of the active [in focus] input [textarea] field.

In FF the coordinate does NOT appear related to the mouse location, previous click, or input field location. It seems to ONLY vary by the amount of horizontal or vertical scrolling. I get minimal (lowest seen was 7) pointerY values when scrolled almost [but not all the way] to the top.

What should the pointer values be? Does FF supply usable values? Those fix-by-scroll-position values seems to be incorrect.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket