I want to start working on implementing support on high contrast
mode.
As most of you will know, high contrast mode is an accessibility
feature in the Windows operating system that changes background and
foreground colors so that they are easier to perceive by low vision
users who require a particular contrast scheme. Browsers generally
inherit this scheme, usually by overriding background and foreground
color and removing background images.
The plan is to follow a similar approach as DOJO does, which in a
nutshell would mean the following:
1. When jQuery loads, create a test div element that is positioned
off-screen. Set different border colors for individual sides of the
div. Also set a background image.
2. After creation, check the element's computed styles. If the border
colors are now the same for each side of the div, or the background
image is no longer set, this means high contrast mode is active. This
is then indicated as a globally accessible flag somewhere on the
jQuery object (for example, "$.highContrast = true").
3. When the high contrast flag is set to true, widgets that normally
have problems displaying correctly in high contrast mode will apply
specific HTML and/or CSS changes to solve these issues.
Examples of changes that could be made when high contrast mode is on:
- Adding border styles. Border styles remain visible in high contrast
mode. this is specifically useful for widgets that indicate selection
using background styles.
- Inserting text. For example, the progressbar widget is difficult to
see in high contrast mode because it uses background images. To get
around this we could ensure that the current value of the progressbar
is shown as text as well when high contrast mode is active (e.g.
"54%"). The text would then correctly inherit the high contrast
styles.
- Inserting images. For example, some components may normally use
background images, but in high contrast mode the widget could instead
inject a high contrast version of the image into the DOM (images in
the DOM will still be visible in high contrast mode)
- Unhiding content. for example, icon buttons are implemented using a
background image. These buttons also have a hidden span element that
contains the button's textual name. In high contrast mode, we can
unhide this element, so that the button would still be usable as a
text button.
- Applying focus styles. To make it easier to see which element has
focus, we could add thicker outline or border styles for focused
elements.
The point is, there will be a flag set that will allow us to do
whatever is necessary to make widgets usable in high contrast mode.
I was hoping to get some feedback here about this plan and whether it
is a good idea. Additionally, I would like to know how to approach
with implementing this. For example, what would be the recommended
part of jQuery to add such a test div element, and in what namespace
should the high contrast flag be set?
Thanks,
Hans
It follows a similar approach as the description I gave before, and
currently makes icon buttons, the close button in dialogs, and the
progress bar compatible with high contrast mode.
Any feedback would be appreciated,
Hans
--
You received this message because you are subscribed to the Google Groups "jQuery Accessibility" group.
To post to this group, send email to jquer...@googlegroups.com.
To unsubscribe from this group, send email to jquery-a11y...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jquery-a11y?hl=en.
Thanks for the comments. Some replies inline:
On Feb 26, 3:07 am, Scott González <scott.gonza...@gmail.com> wrote:
> This looks like a good start, but I've got a few comments:
>
> - The styling for the test div should be in the JavaScript instead of the
> theme file (see how jQuery.support works).
OK, will do.
> - We should run this code immediately and store the flag as part of the
> public API. Maybe expose the flag as jQuery.highContrast.
It is currently run as the page HTML is loaded, there's a call: $
(document).ready($.ui.highContrastMode); towards the end of the core
jQuery UI file. Should it be done differently? Where would be a good
place to do so? (I'll happily take pointers to source code or howtos
if that wastes less of your time. :-)
As for the flag, OK. I figured exposing it on the UI object sort of
made sense as it will mostly be the UI that cares about it. Should the
detection code move to jQuery proper, too, or only the flag itself?
> - Can the style property checks go through jQuery instead of using the
> native DOM methods? If so, it'll make the code smaller.
Doh. I'm a jQuery novice, and did look for a getCS equivalent but
couldn't find one. After some more googling, looks like $(el).css(...)
should work, I'll test that and submit an updated patch.
Cheers,
Gijs
--