webcompat / web-bugs

A place to report bugs on websites.
https://webcompat.com
Mozilla Public License 2.0
743 stars 66 forks source link

www.stuff.co.nz - New tab from a link does not open properly #48651

Closed DuncanMcCNZ closed 4 years ago

DuncanMcCNZ commented 4 years ago

URL: https://www.stuff.co.nz

Browser / Version: Firefox 73.0 Operating System: Windows 10 Tested Another Browser: Yes Edge

Problem type: Something else Description: opens new tab, but with focus Steps to Reproduce: Most if not all links at stuff.co.nz (main New Zealand news webiste) do not honour opening new tabs without focus (). This works correctly in Edge, Chrome and Vivaldi.

In Firefox, links on stuff.co.nz opens pages WITH focus.

Workaround: right-click on links and go "Open link in new tab".

Whilst I'm reasonably sure the bug is poor html coding - it would be nice if Firefox "allowed" this to work - as it does in other main browsers.

Browser Configuration
  • None

From webcompat.com with ❤️

cipriansv commented 4 years ago

Thanks for the report @DuncanMcCNZ, but I'm not able to reproduce the issue.

I accessed the link to an article and the corresponding page loaded with no issues as presented in the image below.

image

Tested with: Browser / Version: Firefox Nightly 75.0a1 (2020-02-19) Operating System: Windows 10 Pro

@DuncanMcCNZ, could you please update to the latest Firefox version, and give it another try? Also, could you try clearing cache/data/cookies, disable Ad-blocker (if available), or use a clean profile (about:profiles), and check again?

DuncanMcCNZ commented 4 years ago

Please re-open mate - you’re wrong.

Please have a look at this video… https://www.loom.com/share/9c377bfcb8c5448c96086daac8274137

I followed it up with another vid – to further prove it’s not MY firefox that’s doing it (and as it’s a clean install in Windows Sandbox – it can’t be anyway!). https://www.loom.com/share/f6e61de639ce43458f11945bf484f6a3

Cheers, Duncan

From: Ciprian Ciocan notifications@github.com Sent: Thursday, 20 February 2020 11:00 PM To: webcompat/web-bugs web-bugs@noreply.github.com Cc: Duncan McCormack duncan.mccormack@adrock.com; Mention mention@noreply.github.com Subject: Re: [webcompat/web-bugs] www.stuff.co.nz - see bug description (#48651)

Thanks for the report @DuncanMcCNZhttps://github.com/DuncanMcCNZ, but I'm not able to reproduce the issue.

I accessed the link to an article and the corresponding page loaded with no issues as presented in the image below.

[image]https://user-images.githubusercontent.com/45160931/74922804-6faef600-53d8-11ea-8398-2f7fcc8177a5.png

Tested with: Browser / Version: Firefox Nightly 75.0a1 (2020-02-19) Operating System: Windows 10 Pro

@DuncanMcCNZhttps://github.com/DuncanMcCNZ, could you please update to the latest Firefox version, and give it another try? Also, could you try clearing cache/data/cookies, disable Ad-blocker (if available), or use a clean profile (about:profiles), and check again?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/webcompat/web-bugs/issues/48651?email_source=notifications&email_token=AOTKX2EIZMCW4Q2P5XVQT53RDZICHA5CNFSM4KYDBCP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMM2AXY#issuecomment-588882015, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOTKX2HU7JZK622XL2KMYR3RDZICHANCNFSM4KYDBCPQ.

DuncanMcCNZ commented 4 years ago

I hope this case is NOT closed. I don't know why you can't reproduce it. Here it is, reproduced in Windows Sandbox (a clean/fresh environment).
The behaviour shown in: Google Chrome (OK), Microsoft's new Edge (OK) and Firefox (NOT OK) ... https://www.loom.com/share/9c377bfcb8c5448c96086daac8274137

and a wee follow up vid at bbc.com/news (yes, I accept stuff.co.nz probably have poor HTML coding). I DON'T accept that it works anyway, in other browsers, but not Firefox. https://www.loom.com/share/f6e61de639ce43458f11945bf484f6a3

Cheers, Duncan.

DuncanMcCNZ commented 4 years ago

Sorry... I see my email reply has posted here - bit of a duplicate above.

cipriansv commented 4 years ago

Thanks @DuncanMcCNZ for the clarifying example.

I will move the issue to needsdiagnosis.

DuncanMcCNZ commented 4 years ago

Cheers mate .

Sent from phone


From: Ciprian Ciocan notifications@github.com Sent: Friday, February 21, 2020 7:40:58 PM To: webcompat/web-bugs web-bugs@noreply.github.com Cc: Duncan McCormack duncan.mccormack@adrock.com; Mention mention@noreply.github.com Subject: Re: [webcompat/web-bugs] www.stuff.co.nz - see bug description (#48651)

Thanks @DuncanMcCNZhttps://github.com/DuncanMcCNZ for the clarifying example.

I will move the issue to needsdiagnosis.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/webcompat/web-bugs/issues/48651?email_source=notifications&email_token=AOTKX2ETK5J25NANMWVCVMDRD5ZPVA5CNFSM4KYDBCP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMRWACA#issuecomment-589520904, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOTKX2DJLZUO57TRUD77DXLRD5ZPVANCNFSM4KYDBCPQ.

karlcow commented 4 years ago

ok this is interesting because indeed this is happening to me even with the preferences asking not to.

Capture d’écran 2020-02-24 à 11 00 45

and it is working as intended on other sites.

Let's look at a specific link

<a href="/national/health/119652707/coronavirus-ministry-deciding-if-travel-ban-may-be-extended" 
    data-article-link-country="nz" 
    class="  " 
    title="">Coronavirus travel ban could extend</a>

There's an event associated with anchor on clicks. https://s.go-mpulse.net/boomerang/R9YSD-XHS3U-KQGGF-8W2UT-K37B7

Let's set a breakpoint on click.

ah… in https://www.stuff.co.nz/etc/designs/ffx/nz/stuff/clientlibs-legacy/app.min.clientlibversion.ed17b297997bc20e5869edd217e92ffa.js

  function b(k) {
    var j,
    i,
    h,
    l;
    k = k || window.event;
    j = k.target || k.srcElement;
    i = j.getAttribute('href');
    if (!i) {
      return
    }
    h = (k.ctrlKey || k.shiftKey || k.metaKey);
    if (!h && j.getAttribute('target') !== '_blank') {
      return
    }
    g.open(i);
    if (k.preventDefault) {
      k.preventDefault()
    } else {
      k.returnValue = false
    }
    return false
  }

More specifically these lines:

    h = (k.ctrlKey || k.shiftKey || k.metaKey);
    if (!h && j.getAttribute('target') !== '_blank') {
      return
    }

for me.

11:19:31.323 k.ctrlKey
11:19:31.367 false
11:19:39.459 k.shiftKey
11:19:39.490 false
11:19:46.105 k.metaKey
11:19:46.140 true
11:22:03.064 k
11:22:03.114
click { target: a., buttons: 0, clientX: 507, clientY: 409, layerX: 182, layerY: 8 }

then it goes to g.open(i) with i = "/national/health/119652707/coronavirus-ministry-deciding-if-travel-ban-may-be-extended"

  g.open = function (i, h) {
    var j;
    if (h && h !== '_blank') {
      c.apply(window, arguments)
    } else {
      if (!e) {
        f(i)
      } else {
        j = c.call(window, i);
        j.opener = null
      }
    }
  };

h is undefined which is supposed to be the target.

the f(i) function is creating an iframe.

  function f(i) {
    var j,
    k,
    h;
    j = document.createElement('iframe');
    j.style.display = 'none';
    document.body.appendChild(j);
    k = j.contentDocument || j.contentWindow.document;
    h = k.createElement('script');
    h.type = 'text/javascript';
    h.text = '
        window.parent = null; 
        window.top = null;
        window.frameElement = null; 
        var child = window.open("' + i + '");
        child.opener = null
        ';
    k.body.appendChild(h);
    document.body.removeChild(j)
  }

and this is what creates the issue when the k.body.appendChild(h); is executed.

I wonder what chrome is doing instead. chrome goes exactly through the same code, but handles differently the

var child = window.open("/national/politics/119761552/coronavirus-prime-minister-jacinda-ardern-expected-to-give-update-on-travel-ban")

That looks like https://bugzilla.mozilla.org/show_bug.cgi?id=1081542

karlcow commented 4 years ago

Close as duplicate of https://bugzilla.mozilla.org/show_bug.cgi?id=1081542

DuncanMcCNZ commented 4 years ago

Thanks Karl,

Hope that long standing bug is fixed - five years ago - I see ! :)

Cheers, Duncan.

lock[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue at https://webcompat.com/issues/new if you are experiencing a similar problem.