Proposal: browser.alert.create()
#272
Labels
follow-up: chrome
Needs a response from a Chrome representative
proposal
Proposal for a change or new feature
supportive: safari
Supportive from Safari
Why
Since:
alert()
,prompt()
andconfirm()
methods are not available inserviceWorkers
.window.create
ortabs.create
adds a lot of boilerplate to extensions code are not very suitable for small alerts especially on mobile due to the lack of windows .Resolves: #259
Proposal
Which returns a promise with the returned value.
alert.AlertOptions
has the following options:type
: optional, either one of 'alert', 'confirm', 'prompt'. default: 'alert'title
: optional, title of the alert (addition on top of the classic methods)message
: body text of the dialogdefaultValue
: optional, default value of typeprompt
To have functionality parity with
confirm()
andprompt()
, type 'confirm' and type 'prompt' have been added. This can be dropped if not considered important.Example
Potential designs
How this will look for the end user can be different across browsers and operating systems. On desktop for example, one can consider a dialog window coming from the extension icon (if present). On mobile, it can be a dialog in the middle of the screen, which clearly shows the extension icon next to it to know its source of origin.
Security considerations
If an alert is already being displayed, calling
i18n.alert.create
will reject its returned promise.If many alerts are opened in a short time-frame, browsers can consider a 'do not show again' checkbox just like the classic
window.alert()
API does.The text was updated successfully, but these errors were encountered: