Enhanced support for dialogs

From RuntimeWiki

Jump to: navigation, search



Enhanced support for dialogs

Detailed write-up


A lot of Ajax applications use dialogs in different forms and most GUI oriented Ajax libraries offer some sort of dialog class. Yet there are a number of features missing from dialog handling like offering native modality handling for inline HTML dialogs or HTML support in most native dialogs.

Why Is This Important?

Dialogs make up a substantial part of some user interfaces so both programmer support (code modality) and being able to render HTML in all kinds of dialogs (to be able to keep a consistent style across the GUI) is important.

Possible solutions

Below is an attempt to list all interesting properties related to dialogs. Some are already implemented in most browsers, others are implemented in some browsers, but they are all mentioned for completeness.

Dialog types

The following dialog types exist today:

  • DIALOGWINDOW: a separate native window for dialog contents popped by showModalDialog() or window.open().
  • INLINEHTMLDIALOG: dialog contents floated above dimmed main window contents. Usually implemented using CSS positioning and IFRAME tricks.
  • ALERT: the native alert() and prompt() dialogs.
  • BEFOREUNLOAD: "leaving page warning" dialog as a result of a non-false return from an onbeforeunload event handler. (http://pro-thoughts.blogspot.com/2006/03/onbeforeunload-event.html)
HTML support

Support for rendering HTML contents should be added to as many dialog types as possible. DIALOGWINDOW and INLINEHTMLDIALOG already do this but BEFOREUNLOAD needs this and also ALERT (but may not be so important).

Page GUI modality

The different dialog types should have native support for behaving modally with respect to the rest of the page's GUI elements. All types except INLINEHTMLDIALOG already have this, so some way of designating an element tree to act modally with respect to the rest of the page would be appropriate.

Code modality

"First class" modal dialogs should make the event handler popping the dialog wait for the dialog to be dismissed, and then continue to execute the remaining event handler code. DIALOGWINDOW and ALERT already do this, BEFOREUNLOAD is not popped from an event handler and INLINEHTMLDIALOG needs support for this.

In particular, this is interesting when the page author wants to pop a dialog at page unload (f ex asking "Do you want to save?"). BEFOREUNLOAD is often too limited to be used in these scenarios. The risks of an ill-behaved page never allowing the user to leave the page are mitigated by enhancements described in >Browser Unresponsive Mode Enhancements. Dialog modal behaviour through coroutines are discussed in JavaScript Coroutine Support (was Pause Release).

Background material that request this feature

Inline HTML dialogs are mentioned in JavaScript Coroutine Support (was Pause Release).

Currently the HTML5 spec has some mentioning of modal dialogs, but it seems to be mainly oriented around whole page sections that are displayed on/off, or (reluctantly ;-) showModalDialog().


In this section, the contributors should express their opinions about this feature request, such as providing particular technical analysis or describing in prose why this feature is important (or not). It is recommended that each contributor create his own level-3 sub-section

Phase I Voting - Vote for Your Top 5 Features

NOTE: PHASE I VOTING IS NOW OPEN. (2008-04-01) We have now changed the voting procedure. Instead of putting votes on each separate wiki page, we are asking people to cast their Phase I Votes on the following wiki page:

Phase II Voting

More about this later.

Personal tools