Document element scrolled after firing synthetic mousedown/mouseup/click events
Reported by
m...@mankz.com,
Nov 2 2016
|
||||
Issue descriptionChrome Version : 54.0.2840.71 (64-bit) URLs (if applicable) : http://www.bryntum.com/temp/clicktest/ Other browsers tested: Add OK or FAIL, along with the version, after other browsers where you have tested this issue: Safari: FAIL Firefox: OK IE: What steps will reproduce the problem? (1) Go to our Siesta (testing tool) test page http://www.bryntum.com/temp/clicktest/ (2) Run test. notice page scrolls after second synthetic click (3) What is the expected result? Synthetic clicks should not trigger different browser behavior compared to native click in this case. What happens instead? Please provide any additional information below. Attach a screenshot if possible.
,
Nov 10 2016
,
Nov 10 2016
Navid, mind taking a look?
,
Nov 10 2016
,
Nov 11 2016
mats@ do you have a standalone page that shows the problem? In your example this is the standalone page: http://www.bryntum.com/temp/clicktest/app.html and when I try to click the dropdown and choose one of the options no extra scrolling happens anyway.
,
Nov 11 2016
It's for synthetic events fired, not for manual clicks.
,
Nov 11 2016
Do you know how that generates those synthetic events? Webdriver or something else? Or is it just "new MouseEvent('type')' and dispatchEvent to the nodes? Because I tried that and that also didn't work.
,
Nov 11 2016
Yes our testing tool (Siesta) generates these events, createMouseEvent method looks like:
createMouseEvent: function (type, options, el) {
var event;
var global = this.global
options = $.extend({
bubbles : !/(ms)?(mouse|pointer)enter/i.test(type) && !/(ms)?(mouse|pointer)leave/i.test(type),
cancelable : !/(ms)?(mouse|pointer)move/i.test(type),
view : global,
detail : 0,
screenX : 0,
screenY : 0,
ctrlKey : false,
altKey : false,
shiftKey : false,
metaKey : false,
/*
* https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
*
* A number representing a given button:
0: Main button pressed, usually the left button or the un-initialized state
1: Auxiliary button pressed, usually the wheel button or the middle button (if present)
2: Secondary button pressed, usually the right button
3: Fourth button, typically the Browser Back button
4: Fifth button, typically the Browser Forward button
* */
button : 0,
/*
* https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
*
* 0 : No button or un-initialized
* 1 : Left button
* 2 : Right button
* 4 : Wheel button or middle button
* 8 : 4th button (typically the "Browser Back" button)
* 16 : 5th button (typically the "Browser Forward" button)
*
* */
buttons : 0,
relatedTarget : undefined
}, options);
if (!("clientX" in options) || !("clientY" in options)) {
var center = this.findCenter(el);
options = $.extend({
clientX: center[0],
clientY: center[1]
}, options);
}
// Not supported in IE
if ("screenX" in window) {
options = $.extend(options, {
screenX: global.screenX + options.clientX,
screenY: global.screenY + options.clientY
});
}
var doc = el.ownerDocument;
if (!$.browser.msie && !this.harness.isPhantomJS && global.MouseEvent) {
event = new global.MouseEvent(type, options);
}
// use W3C standard when available and allowed by "simulateEventsWith" option
else if (doc.createEvent && this.getSimulateEventsWith() == 'dispatchEvent') {
var isPointer = type.match(/^(ms)?pointer/i)
event = doc.createEvent(isPointer ? (isPointer[ 1 ] ? 'MS' : '') + 'PointerEvent' : 'MouseEvents');
event[ isPointer ? 'initPointerEvent' : 'initMouseEvent' ](
type, options.bubbles, options.cancelable, options.view, options.detail,
options.screenX, options.screenY, options.clientX, options.clientY,
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey,
options.button, options.relatedTarget || doc.documentElement,
// the following extra args are used in the "initPointerEvent"
// offsetX, offsetY
null, null,
// width, height
null, null,
// pressure, rotation
null, null,
// tiltX, tiltY
null, null,
// pointerId
null,
// pointerType
// NOTE: this has to be set to "mouse" (IE11) or 4 (IE10, 11) because otherwise
// ExtJS5 blocks the event
// need to investigate what happens in SenchaTouch
4,//'mouse',
// timestamp
null,
// isPrimary
null
);
} else if (doc.createEventObject) {
event = doc.createEventObject();
$.extend(event, options);
event.button = { 0: 1, 1: 4, 2: 2 }[ event.button ] || event.button;
}
// Mouse over is used in some certain edge cases which interfer with this tracking
if (type !== 'mouseover' && type !== 'mouseout') {
var elWindow = doc.defaultView || doc.parentWindow;
var cursorX = options.clientX;
var cursorY = options.clientY;
// Potentially we're interacting with an element inside a nested frame, which means the coordinates are local to that frame
if (elWindow !== global) {
var offsets = this.$(elWindow.frameElement).offset();
cursorX += offsets.left;
cursorY += offsets.top;
}
if (!options.doNotUpdateCurrentPosition) {
this.currentPosition[ 0 ] = cursorX;
this.currentPosition[ 1 ] = cursorY;
}
}
return event;
},
,
Nov 22 2016
Were you able to reproduce it? |
||||
►
Sign in to add a comment |
||||
Comment 1 by jmukthavaram@chromium.org
, Nov 3 2016Labels: M56
Status: Untriaged (was: Unconfirmed)
1.9 MB
1.9 MB View Download