| Dialog | [inline:dialog_box.png] |
| TooltipDialog | [inline:tooltipDialog.png] |
| ProgressBar | [inline:progress_bar.png] |
| TitlePane Click arrow to expand/contract |
[inline:title_pane.png] |
| Tooltip | [inline:tooltip.png] |
A ProgressBar gives dynamic feedback on the progress of a long-running operation. The progress can be updated by JavaScript function calls. This method works best for long-running JavaScript operations, or a series of JavaScript XHR calls to the server.
This progress meter is updated using JavaScript
See the API docs for more information on update().
Suppose you do not know the maximum up front. ProgressMeter has an indeterminate version, which does not display a percentage bar. Instead, an animation indicates that something is happening.
This code fragment displays the indeterminate progress meter while performing an XHR call. The time spent for the call is used to estimate the length of 10 calls, which will then be used as the maximum value. (Note: you will need to provide your own XHR url here.)
dojo.addOnLoad(function() {
// This starts the indeterminate bar
dijit.byId("setTestBar").update({indeterminate: true});
// Do a call to see what the average response time is
timeStart = new Date();
var d = dojo.xhrGet({
url: "../services/waste_time.jsp",
handleAs: "text"
});
d.addCallback(function() {
// Stop the indeterminate bar
dijit.byId("setTestBar").update({indeterminate: false});
avgTime = new Date() - timeStart;
//Now you can estimate the time for 10 calls
avgTime10 = avgTime * 10;
dijit.byId("setTestBar").update({maximum: avgTime10});
});
});
|
dijit.ProgressBar
a progress widget
|
||
|
Attributes
|
||
| indeterminate | Boolean false |
Default is false. Show progress true: show that a process is underway but that the progress is unknown |
| maximum | Float 100 |
Maximum value possible |
| places | Number 0 |
number of places to show in values; 0 by default |
| progress | String "0" |
(Percentage or Number) initial progress value. with "%": percentage value, 0% <= progress <= 100% or without "%": absolute value, 0 <= progress <= maximum |
|
Methods
|
||
| update(/* Object */prg) | update progress information - use progress, maximum and indeterminate properties in the object, just as in the attributes | |
|
Extension Points
|
||
| onChange() | Callback for when progress changes | |
The progress bar is made accessible by providing a solid border around the visual progress indicator. This border is visible in high contrast mode as well as when images are turned off.
The internalProgress div is assigned the ARIA role of progressbar The valuenow attribute is updated as the progress is updated. No valuemin and valuemax values are provided since the valuenow attribute may be a string provided by the Web developer.
Note: The hot key for the Window-Eyes screen reader to speak progress bar information is ctrl-ins-b. JAWS provides the hot key ins-tab for announcing progress bar name and status.JAWS also has a setting to select the frequency of progress bar announcements. Go to the Configuration Manager, Select Set Options, then User Options and select the desired announcement frequency.
The ARIA valuenow property is set to the ProgressBar's progress value. The valuemin and valuemax properties are set to 0 and the ProgressBar's maximum, respectively.
Tooltip is similar to the title="" attribute in regular HTML, but is much more flexible. You can control the display timing, and specify arbitrary HTML for the tooltip text.
|
dijit.Tooltip
Internal widget that holds the actual tooltip markup, which occurs once per page. Called by Tooltip widgets which are just containers to hold the markup
|
||
|
Attributes
|
||
| connectId | String | Id of domNode to attach the tooltip to. (When user hovers over specified dom node, the tooltip will appear.) New in 1.0 You an also specify a comma-separated list of id to attach to multiple nodes. When using the programmatic interface, you can pass an array of Strings. |
| label | String | Text to display in the tooltip. Specified as innerHTML when creating the widget from markup. |
| showDelay | Integer 400 |
Number of milliseconds to wait after hovering over/focusing on the object, before the tooltip is displayed. |
Tooltips are displayed when the associated item receives focus or a mouseover event. Be careful when assigning tooltips to arbitrary elements such as spans of text which may not receive keyboard focus because users of assistive technology or keyboard only users will not benefit from the tooltip. If the tooltip information is important, make certain that the item which triggers display of the tooltip can receive focus via the keyboard. This can be accomplished by adding a tabindex="0" attribute onto the trigger element to put it into the tab order of the page.
Dijit's modal Dialog Box simulates a regular GUI dialog box. The contents can be arbitrary HTML, but are most often a form or a short paragraph. The user can close the dialog box without acting by clicking on the X button in the top-right corner.
The following dialog box shows a simple Change Password form:
|
Everything in the dialog box is wrapped in an implicit form. The code in the execute() attribute is executed when the dialog is submitted normally.
Dialog, like most forms, does not automatically set the focus on the first form field. To do this with Dijit Dialog or TooltopDialog, simply define this code snippet once:
var focusFirstInput = function(e) {
dijit.focus(dojo.query('input', this.domNode)[0]);
}
Then use dojo.connect to hook it to each dialog's onOpen event:
var c = dojo.connect(someDialogWidget, 'onOpen', dojo.hitch(someDialogWidget, focusFirstInput));
In 1.1 the Dialog has been updated to find and set focus to the first focusable element within the dialog. Thus, the above code snippet is no longer necessary in 1.1. See additional information in the 1.1 Accessibility section below.
A variant on Dialog Box is dijit.TooltipDialog. This displays the dialog box contents in a Tooltip
Although both Dialog and TooltipDialog are modal, TooltipDialog can be closed by clicking anywhere on the screen, whereas for Dialog you must click on the [x] mark of the Dialog.
A TooltipDialog appears as a drop down from a button, similar to a drop down button.
|
dijit.Dialog, dijit.TooltipDialog
Simulates GUI Dialog box. Dialog displays forms overlaying
the current page, TooltipDialog displays form in a tooltip.
|
||
|
Attributes
|
||
| errorMessage | String Locale dep. |
Message that shows if an error occurs |
| extractContent | Boolean false |
Extract visible content from inside of <body> .... </body> |
| href | String | The href of the content that displays now. Set this at construction if you want to load data externally when the pane is shown. (Set preload=true to load it immediately.) Changing href after creation does not have any effect; see setHref(); |
| isLoaded | Boolean false |
Tells loading status see onLoad|onUnload for event hooks |
| loadingMessage | String Locale dep. |
Message that shows while downloading |
| open | Boolean false |
Is dialog box initially open |
| parseOnLoad | Boolean true |
parse content and create the widgets, if any |
| preload | Boolean false |
Force load of data even if pane is hidden. |
| preventCache | Boolean false |
Cache content retreived externally |
| refreshOnShow | Boolean false |
Refresh (re-download) content when pane goes from hidden to shown |
| title | String | (TooltipDialog only) Description of tooltip dialog (required for a11Y). For regular dialogs, you can set dijit.byId("dlg").titleNode.innerHTML to change the title. |
|
Methods
|
||
| cancel() | Cancels a inflight download of content | |
| hide() | Hide the dialog if we haven't been initialized yet then we aren't showing and we can just return | |
| layout() | Sets the background to the size of the viewport (rather than the size of the document) since we need to cover the whole browser window, even if the document is only a few lines long. | |
| orient(/*Object*/ corner) | (TooltipDialog only) configure widget to be displayed in given position relative to the button. See dijit.Tooltip for notes on positioning | |
| refresh() | Force a refresh (re-download) of content, be sure to turn off cache we return result of _prepareLoad here to avoid code dup. in dojox.layout.ContentPane | |
| resize(/* String */size) | Explicitly set this widget's size (in pixels), and then call layout() to resize contents (and maybe adjust child widgets) | |
| setContent(/*String|DomNode|Nodelist*/data) | Replaces old content with data content, include style classes from old content | |
| setHref(/*String|Uri*/ href) | Reset the (external defined) content of this pane and replace with new url Note: It delays the download until widget is shown if preload is false | |
| show() | Dialog only display the dialog first time we show the dialog, there's some initialization stuff to do | |
|
Extension Points
|
||
| onContentError(/*Error*/ error) | called on DOM faults, require fault etc in content default is to display errormessage inside pane | |
| onDownloadEnd() | called when download is finished | |
| onDownloadError(/*Error*/ error) | Called when download error occurs, default is to display errormessage inside pane. Overide function to change that. The string returned by this function will be the html that tells the user a error happend | |
| onDownloadStart() | called before download starts the string returned by this function will be the html that tells the user we are loading something override with your own function if you want to change text | |
| onLoad(/* Event */e) | Event hook, is called after everything is loaded and widgetified | |
| onOpen(/*Object*/ pos) | (TooltipDialog only) called when dialog is displayed. See dijit.Tooltip for pos details. | |
| onUnload(/* Event */e) | Event hook, is called before old content is cleared | |
When a dialog is opened focus goes to the title section of the dialog. This was implemented to provide screen reader support to speak the title of the dialog when it is opened. Likewise, when a tooltip dialog is opened, focus is placed on the container of the tooltip dialog. In future versions of the dialog and tooltip dialog widgets, focus will go to the first item in the dialog or tooltip dialog.
When focus is in a dialog, pressing the tab key will move focus forward to each focusable element within the dialog. When focus reaches the last focusable element in the dialog, pressing tab will cycle focus back to the dialog title. Pressing shift-tab will move focus backwards through focusable elements within the dialog until the dialog title is reached. If focus has previous cycled forward through all of the elements, pressing shift-tab with focus on the dialog title will move focus to the last element in the dialog. If focus has not previously been cycled through all of the focusable elements in the dialog using the tab key, pressing shift-tab with focus on the dialog title will leave focus in the title. The same focus cycling applies to the tooltip dialog as well with focus being set to the tooltip dialog container since there is no dialog title.
Known Issue: On Windows, In Firefox 2, when in High Contrast mode, the dialog with display correctly, but the underlying page will not be seen.
| Action | Key |
|---|---|
| Navigate to next focusable element in the dialog/tooltip dialog | tab |
| Navigate to previous focusable element in the dialog/tooltip dialog | shift-tab (see general section above for additional details) |
| Close the dialog/tooltip dialog | escape |
When a dialog is opened focus goes to the first focusable element within the dialog. The first focusable element may be an element which appears in the tab order by default such as a form field or link, an element with a tabindex attribute value of 0 or an element with a tabindex value greater than 0. Elements with a tabindex value greater than 0 will appear in the tab order before elements with a tabindex of 0 or those in the tab order by default. If the dialog does not contain a focusable item, focus will be set to the dialog container element when the dialog is opened. The same focus behavior has been implemented for tooltip dialog
When focus is in a dialog, pressing the tab key will move focus forward to each focusable element within the dialog. When focus reaches the last focusable element in the dialog, pressing tab will cycle focus back to the first focusable item. Pressing shift-tab will move focus backwards through focusable elements within the dialog. When the first focusable item is reached, pressing shift-tab will move focus to the last focusable item in the dialog.
Known Issues:
| Action | Key |
|---|---|
| Navigate to next focusable element in the dialog/tooltip dialog | tab |
| Navigate to previous focusable element in the dialog/tooltip dialog | shift-tab |
| Close the dialog/tooltip dialog | escape |
A TitlePane is a pane with a title on top that can be opened or collapsed. The visibility of the container is toggled by activating an arrow "button" on the title bar via the mouse or keyboard.
|
dijit.TitlePane
A pane with a title on top, that can be opened or collapsed.
|
||
|
Attributes
|
||
| duration | Integer 250 |
milliseconds to fade in/fade out |
| open | Boolean true |
Whether pane is opened or closed. |
| title | String | Title of the pane. Use setTitle() to change after creation time. |
|
Methods
|
||
| setContent(/* String */content) | Typically called when an href is loaded. Our job is to make the animation smooth | |
| setTitle(/* String */title) | sets the text of the title | |
| toggle() | switches between opened and closed state | |
Each title pane title is included in the tab order of the document.
| Action | Key |
|---|---|
| toggle open/close of the title pane | enter or space key with focus on the title pane title |
| Navigate into an opened title pane | tab |
The title pane container will have an ARIA labelledby property which points to the id of the title pane title. The title pane title has the ARIA role of button and property of haspopup=true to indicate that it controls the display of the pane. The role of button is used to indicate to the user that an action will occur when the button is activated. The tilte pane container will have an ARIA role of region which will be supported in Firefox 3 and identified by future versions of the screen readers.