Skip to content
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

Tabs isn't clickable after opening of any link with click handlers #2

Closed
Infocatcher opened this issue Jun 28, 2013 · 3 comments

Comments

Projects
None yet
1 participant
@Infocatcher
Copy link
Owner

commented Jun 28, 2013

Something went wrong after left-click imitation...

STR:

  1. Open http://infocatcher.ucoz.net/ext/fx/right_links/testcase.html
  2. Right-click on javascript: void(0); | onclick = window.open(location.href); in "Click handlers links" section
  3. Try click on any not selected tab or on tab close button – nothing happens after first click
@Infocatcher

This comment has been minimized.

Copy link
Owner Author

commented Jul 15, 2013

Minimal code to reproduce this bug (for the same testcase):

  • Set devtools.chrome.enabled = true in about:config
  • Open Tools – Web Developer – Scratchpad (Shift+F4)
  • Select Environment – Browser
  • Insert below code and click Execute – Run (Ctrl+R)
var trg = content.document.querySelector('a[onclick="window.open(location.href);"]');

dispatchMouseEvent(trg, {
    type: "mousedown",
    ctrlKey: true
});
dispatchMouseEvent(trg, {
    type: "mouseup",
    ctrlKey: true
});
dispatchMouseEvent(trg, {
    type: "click",
    ctrlKey: true
});

function dispatchMouseEvent(trg, e) {
    var doc = trg.ownerDocument;
    var evt = doc.createEvent("MouseEvents");
    evt.initMouseEvent( // https://developer.mozilla.org/en/DOM/event.initMouseEvent
        e.type, true /* canBubble */, true /* cancelable */, doc.defaultView, 1,
        e.screenX || 0, e.screenY || 0, e.clientX || 0, e.clientY || 0,
        e.ctrlKey || false, e.altKey || false, e.shiftKey || false, e.metaKey || false,
        e.button || 0, null
    );
    trg.dispatchEvent(evt);
}

And all works fine without "mousedown" event imitation...

Infocatcher added a commit that referenced this issue Jul 16, 2013

Add "workaroundForMousedownImitation" preference
to allow disable workaround for "mousedown" imitation
(#2)
@Infocatcher

This comment has been minimized.

Copy link
Owner Author

commented Jul 16, 2013

@Infocatcher

This comment has been minimized.

Copy link
Owner Author

commented Aug 22, 2013

Seems to works fine for me, so I closed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.