Skip to content

Commit

Permalink
dojo/hccss
Browse files Browse the repository at this point in the history
  • Loading branch information
wkeese committed Apr 25, 2012
1 parent 8a63689 commit 2eac111
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 67 deletions.
52 changes: 1 addition & 51 deletions dijit/hccss.rst
Expand Up @@ -4,54 +4,4 @@
dijit.hccss
===========

:since: v1.7

.. contents ::
:depth: 2
Introduction
============

By doing a require() of "dijit/hccss", the "dijit_a11y" CSS class will be added to your document's <body> tag
if the machine is in high contrast mode, and thus the browser doesn't display background images.
This is useful for Internet Explorer and Firefox running on Windows.
It doesn't apply to Chrome or Safari (on mobile, mac, or desktop), which always display background images.

Usage
=====

Simply require the module:

.. js ::
require(["dijit/hccss"]);
And then reference the class name from CSS rules, etc.:


.. css ::
.myTitlePane .label {
/* normally hide the label in preference to the icon */
display: none;
}
.dijit_a11y .myTitlePane .label {
/* but display the label in high contrast mode, since the icon won't appear */
display: block;
}
Execution Time
==============

Note that the dojo/domReady! dependency (if present) will resolve before the CSS class is added.
Thus if your widget has JavaScript sizing code, it's not sufficient to wait for dojo/domReady!.
Rather, the widget should be instantiated inside of a ready() call:

.. js ::
require(["dojo/ready", "dijit/hccss"], function(ready){
ready(function(){ // wait for DOMReady and for hccss code to execute
new MyTitlePane(...);
});
});
Deprecated, use :ref:`dojo/hccss <dojo/hccss>` instead.
17 changes: 1 addition & 16 deletions dojo/dnd.rst
Expand Up @@ -1245,23 +1245,8 @@ representations are used for the DnD operations:

* If the move operation can be performed the DnD character is a <.

* If the move opertation can not be performed the DnD character is an o.
* If the move operation can not be performed the DnD character is an o.

However, in order to detect that high contrast mode has been set on a Windows system, you will need to include an
additional file from the :ref:`Dijit system <dijit/a11y>` on your pages which use DnD. This file performs the check that
high contrast mode has been set on a Windows system. When high contrast mode is turned on all color references are
reduced to just a foreground and background color and CSS background images are not displayed. For more information on
Windows High Contrast mode see `Widgets and High Contrast Mode <http://dojotoolkit.org/community/a11yHighContrastMode>`_
. Since DnD uses background images for the icons, the character equivalents are rendered when High Contrast mode is
detected. You should include this additional file in all of your pages that use drag and drop in order to provide full
accessibility. Add the following in your page below the other dojo includes:

.. js ::
require(["dijit/_base/hccss.js"]);
Note that your src path may vary and you may need to do a custom build to include this file since it is not included in
``dojo.js`` by default.

See also
========
Expand Down
60 changes: 60 additions & 0 deletions dojo/hccss.rst
@@ -0,0 +1,60 @@
.. _dojo/hccss:

==========
dojo/hccss
==========

:since: v1.8

.. contents ::
:depth: 2
Introduction
============

By doing a require() of "dojo/hccss", the "dj_a11y" CSS class will be added to your document's <body> tag
if the machine is in high contrast mode, and thus the browser doesn't display background images.

This is useful for Internet Explorer and Firefox running on Windows.
It doesn't apply to Chrome or Safari (on mobile, mac, or desktop), which always display background images.

hccss will also set the has("highcontrast") flag so code can check directly whether or not it's in high contrast mode.

Usage
=====

Simply require the module:

.. js ::
require(["dojo/hccss"]);
And then reference the class name from CSS rules, etc.:

.. css ::
.myTitlePane .label {
/* normally hide the label in preference to the icon */
display: none;
}
.dj_a11y .myTitlePane .label {
/* but display the label in high contrast mode, since the icon won't appear */
display: block;
}
Execution Time
==============

Note that the dojo/domReady! dependency (if present) will resolve before the CSS class is added.
Thus if your widget has JavaScript sizing code, it's not sufficient to wait for dojo/domReady!.
Rather, the widget should be instantiated inside of a ready() call:

.. js ::
require(["dojo/ready", "dojo/hccss"], function(ready){
ready(function(){ // wait for DOMReady and for hccss code to execute
new MyTitlePane(...);
});
});
4 changes: 4 additions & 0 deletions releasenotes/1.8.rst
Expand Up @@ -60,6 +60,10 @@ dojo/DeferredList

While ``dojo/DeferredList`` is not changed, it is deprecated in lieu of ``dojo/promise/all`` and ``dojo/promise/first``.

dojo/hccss
----------
The dijit/hccss module has moved to dojo core, with a stub left in dijit for backwards compatibility.

dojo/parser
-----------

Expand Down

0 comments on commit 2eac111

Please sign in to comment.