New issue
Advanced search Search tips

Issue 661772 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug
M56



Sign in to add a comment

Document element scrolled after firing synthetic mousedown/mouseup/click events

Reported by m...@mankz.com, Nov 2 2016

Issue description

Chrome 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.

 
Cc: jmukthavaram@chromium.org
Labels: M56
Status: Untriaged (was: Unconfirmed)

Thanks for the report.

Able to reproduce the issue on Win 7, Mac OS X 10.11.4, Ubuntu 14.04 using Chrome Canary #56.0.2907.0, Stable 54.0.2840.87 versions.

This is non-regression issue, issue existing from M40 build, #40.0.2172.0.

Observed errors while running the below URL in Chrome -35.0.1849.0 build.

http://www.bryntum.com/temp/clicktest/

Please find the attached screenshot for reference.


661772-M40.mp4
1.9 MB View Download
Components: Blink>Scroll Blink>Input

Comment 3 by bokan@chromium.org, Nov 10 2016

Cc: mustaq@chromium.org
Labels: OS-All
Owner: nzolghadr@chromium.org
Status: Assigned (was: Untriaged)
Navid, mind taking a look?

Comment 4 by bokan@chromium.org, Nov 10 2016

Labels: Hotlist-Input-Dev
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.

Comment 6 by m...@mankz.com, Nov 11 2016

It's for synthetic events fired, not for manual clicks.
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.

Comment 8 by m...@mankz.com, 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;
        },

Comment 9 by m...@mankz.com, Nov 22 2016

Were you able to reproduce it?

Sign in to add a comment