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)
Developer Documentation Graveyard
API: DOM
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
Reporter | ||
Comment 1•9 years ago
|
||
when i call window.open('http://mozilla.org', '_blank'); in a function, it opens a new tab and it's in focus (foreground)
Reporter | ||
Comment 2•9 years ago
|
||
this is fixed if you add this:
notification.onclick = function(event) {
event.preventDefault();
window.open('http://www.mozilla.org', '_blank');
}
Reporter | ||
Updated•9 years ago
|
Keywords: dev-doc-needed
Comment 3•9 years ago
|
||
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
Comment 4•9 years ago
|
||
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!
You need to log in
before you can comment on or make changes to this bug.
Description
•