A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

Modal prompts

From WHATWG Wiki
Revision as of 14:17, 14 February 2012 by Jochen (talk | contribs) (Initial proposal for dealing with modal dialogs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Overview

This document describes a proposal for gradually removing modal dialogs and prompts from the platform.

Rationale

In a tabbed browser, modal dialogs are potentially disrupting the work flow of the user as they can't interact with any other web site as long as the modal dialog is displayed.

Furthermore, implementing showModalDialog might require running a nested message loop which caused several security issues in the past.

Proposal

Callbacks

For the following modal prompts, a callback parameter is introduced

  • alert
  • confirm
  • prompt

When these functions are invoked with a callback parameter, they return immediately (instead of blocking). The callback is invoked as soon as the modal dialog closes. For confirm and prompt, the callback takes one parameter which is set to the value to modal version would have returned.

showModalDialog

window.showModalDialog should be deprecated and removed from the platform. Web sites should use e.g. window.open instead.


Examples

window.confirm("Are you sure?", function(result) { if (result) doIt(); });

Issues

What would a reasonable plan to deprecate showModalDialog look like