Closed Bug 1286536 Opened 4 years ago Closed 4 years ago

Add support for buttons to nsIAlertsService

Categories

(Toolkit :: Notifications and Alerts, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1225110

People

(Reporter: bsilverberg, Unassigned)

References

(Blocks 1 open bug)

Details

For parity with the Chrome notifications API [1], our notifications API should support creating alerts with buttons. Chrome allows up to 2 buttons to be included in the alert, with each button having a title and icon [2]. When a button is clicked an event should be dispatched which the API can listen for. As per chrome.notifications.onButtonClicked [3], the event should include the notificationId and the buttonIndex.

[1] https://developer.chrome.com/extensions/notifications
[2] https://developer.chrome.com/extensions/notifications#type-NotificationOptions
[3] https://developer.chrome.com/extensions/notifications#event-onButtonClicked
Thanks, Bob! The web notifications API calls these "actions," so I'll close this as a dupe of that bug. Implementing them in `nsIAlertsService` will make them available to all callers.

On OS X, we might place the actions in a drop-down, to make room for our own actions ("disable notifications" and "open notification settings"). We'll probably only do that for web notifications, though; web extensions and chrome JS callers could make use of both buttons.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1225110
You need to log in before you can comment on or make changes to this bug.