Accessible Popup Help with Dojo and ARIA

This example shows Popup or Bubble help that has been implemented using a Dojo dijit.TooltipDialog. A Tooltip dialog is invoked via dijit.form.DropDownButton. In this case the DropDownButton has been restyled to look like a link, although the screen reader will announce it as a menu button. Activate the More Info? element below to see the Popup Help functionality.

I am using Dojo from the Google CDN (content delivery network).

Here is the code to create the TooltipDialog. I added an explicit close button, although by default the dialog will close if the user presses escape or clicks outside of it.

<div dojoType="dijit.form.DropDownButton" class="tooltipLink" >
	<span>More Info?</span>
	<div dojoType="dijit.TooltipDialog" id="tooltipHelpDlg" title="More Info Popup Help" style="width:350px" >
		<div class="buttonLink" style="float:right;font-size:x-small" title="close" tabindex="0" 
		dojoType="dijit.form.Button">[close]
			<script type="dojo/method" event="onClick">
					dijit.byId('tooltipHelpDlg').onCancel();
			</script>
		</div>
		<div style="margin-top:1em" id="helpText" >
			dialog contents  		 		
		</div>	
	</div>
</div>

I added styles to make the dijit.form.DropDownButton look like a link.

Normally, a dijit.TooltipDialog is given the ARIA role of dialog. I added a dojo.addOnLoad handler to connect to the dialog onShow event and changed the role to alertdialog so the screen reader would automatically speak the contents of the dialog when it is displayed.

Posted on May 7, 2009 by Becky Gibson