Closed Bug 1206798 Opened 9 years ago Closed 9 years ago

clicking on notification with target '_blank' should open new tab in foreground

Categories

(Developer Documentation Graveyard :: API: DOM, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: edwong, Unassigned)

Details

1. goto http://people.mozilla.org/~ewong2/push-notification-test/ 2. click on 'pop notification' button 2b. click on 'allow for session' in permissions door hanger. 3. click on notification banner actual: mozilla.org opens in a new tab in background expected: should open in foreground
when i call window.open('http://mozilla.org', '_blank'); in a function, it opens a new tab and it's in focus (foreground)
this is fixed if you add this: notification.onclick = function(event) { event.preventDefault(); window.open('http://www.mozilla.org', '_blank'); }
Keywords: dev-doc-needed
This is defined in the spec at https://notifications.spec.whatwg.org/#activating-a-notification : "If the event’s canceled flag is unset, the user agent should bring the notification’s related browsing context’s viewport into focus." We should make sure this default behaviour is documented clearly on MDN and make sure examples use preventDefault when this isn't desired.
Component: Notifications and Alerts → API: DOM
Product: Toolkit → Developer Documentation
Summary: clicking on notification with target '_blank' should open new tab in foreground. → clicking on notification with target '_blank' should open new tab in foreground
Version: 43 Branch → unspecified
I have added an example to the Notification.onclick doc, which illustrates this very point: https://developer.mozilla.org/en-US/docs/Web/API/Notification/onclick#Examples Let me know if this looks ok. Thanks!
Status: NEW → RESOLVED
Closed: 9 years ago
Keywords: dev-doc-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.