Go Back   SitePoint Forums > Forum Index > Design Your Site > Web Page Design > CSS
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Aug 8, 2007, 00:46   #1
brothercake
SitePoint Addict
 
Join Date: Mar 2004
Location: Earth
Posts: 391
Notice: This is a discussion thread for comments about the SitePoint article, Nifty Navigation Using CSS.
__________

"but you're also locking out text-only devices such as screen readers"

A screen reader is NOT a text-only device, and frankly, it's pretty sad to see this myth is still being perpetuated. The dropdown menus example will be inaccessible to the most popular screenreaders because they can't read content which is not displayed. Quite apart from the the fact that such menus are inaccessible to keyboard users.

Pure CSS menus have extremely poor accessibility and usability, and should never be used.
brothercake is offline   Reply With Quote
Old Aug 8, 2007, 01:15   #2
markbrown4
padawan
 
markbrown4's Avatar
 
Join Date: Jul 2006
Location: Victoria, Australia
Posts: 2,734
Quote:
The dropdown menus example will be inaccessible to the most popular screenreaders because they can't read content which is not displayed.
Quite apart from the the fact that such menus are inaccessible to keyboard users.
I've heard JAWS read text with display: none; loud and clear. It seems ridiculous to me that a screen reader should look at the CSS in this way, though I don't doubt that some do actually work like that - I just think it's stupid.

I've used the keyboard to move around CSS only menus fine and dandy,

Quote:
Pure CSS menus have extremely poor accessibility and usability, and should never be used.
frankly, it's pretty sad to see this myth is still being perpetuated
markbrown4 is online now   Reply With Quote
Old Aug 8, 2007, 01:32   #3
AutisticCuckoo
SitePoint Wizard
 
Join Date: Nov 2004
Location: Åsnorrbodarna
Posts: 11,581
Quote:
Originally Posted by markbrown4 View Post
It seems ridiculous to me that a screen reader should look at the CSS in this way, though I don't doubt that some do actually work like that - I just think it's stupid.
A screen reader is not an aural browser, it's a layer on top of the operating system and its applications. I would guess that a screen reader such as JAWS doesn't read the HTML or CSS as such, but works with the DOM tree generated by the actual browser (usually IE). In fact, it's probably not the DOM tree but the rendering tree, which is why elements with display:none don't appear.
AutisticCuckoo is offline   Reply With Quote
Old Aug 8, 2007, 01:36   #4
Karpie
SitePoint Addict
 
Karpie's Avatar
 
Join Date: Jul 2007
Location: Perth, Australia
Posts: 350
By 'pure CSS', you mean keeping navigation items in plain (possibly nested) lists, and then styling them however?

This is the first time I've heard them be described as bad, and I don't understand why at all.
Karpie is offline   Reply With Quote
Old Aug 8, 2007, 01:40   #5
brothercake
SitePoint Addict
 
Join Date: Mar 2004
Location: Earth
Posts: 391
By "pure CSS" I mean menus with only list-item :hover triggers and no additional behavior layer. In order to be useable by mouse users, and accessible to keyboard users, menus need behavioral scripting, to implement things like open/close delays and focus triggers.

The assumption that "works without javascript" == "more accessible" simply doesn't hold true; the situation is more complex than that.

Quote:
Originally Posted by markbrown4 View Post
I've used the keyboard to move around CSS only menus fine and dandy,
Care to show me an example of such a menu?
brothercake is offline   Reply With Quote
Old Aug 8, 2007, 02:05   #6
markbrown4
padawan
 
markbrown4's Avatar
 
Join Date: Jul 2006
Location: Victoria, Australia
Posts: 2,734
Quote:
A screen reader is not an aural browser, it's a layer on top of the operating system and its applications. I would guess that a screen reader such as JAWS doesn't read the HTML or CSS as such, but works with the DOM tree generated by the actual browser (usually IE). In fact, it's probably not the DOM tree but the rendering tree, which is why elements with display:none don't appear.
interesting, thanks Tommy,
Quote:
Quote:
I've used the keyboard to move around CSS only menus fine and dandy,
Care to show me an example of such a menu?
Well.. not the sub-menu items without js. I see what you were getting at now, I wouldn't label it with "extremely poor accessibility and usability, and should never be used."
Quote:
I better relax Sounds that Mark already has plans to start WW 3
i'm CALM!
markbrown4 is online now   Reply With Quote
Old Aug 8, 2007, 18:04   #7
Ned Collyer
SitePoint Community Guest
 
Posts: n/a
UDM menus rock my world.

I would give any "css animated" menus the "dont use it" label.
  Reply With Quote
Old Aug 8, 2007, 21:51   #8
brothercake
SitePoint Addict
 
Join Date: Mar 2004
Location: Earth
Posts: 391
I should probably clarify my point - I'm not levelling my criticism at all forms of CSS navigation, not at all, and the vast majority of what's being taught in this article is solid best-practise.

All I'm saying is that CSS is not suitable for defining behaviors - it doesn't have the capability, and that's what JavaScript is for.

Pure CSS navigation bars and other static navigation structures:

Pure CSS dropdown/flyout menus:
brothercake is offline   Reply With Quote
Old Aug 9, 2007, 04:48   #9
Stormrider
SitePoint Wizard
SitePoint Award Recipient
 
Stormrider's Avatar
 
Join Date: Sep 2006
Location: Nottingham, UK
Posts: 2,522
Why would you put a <div id="navigation"> around the <ul> in the first example, when <ul id="navigation"> would work just as well?
Stormrider is online now   Reply With Quote
Old Aug 10, 2007, 01:47   #10
lloydi
Posts rarely
 
lloydi's Avatar
 
Join Date: Jan 2002
Location: Swindon UK
Posts: 596
At this point, I should just throw this in:

http://www.accessify.com/tools-and-wizards/developer-tools/list-o-matic/

It does a lot of what Rachel refers to here and makes the process of creating horizontal or vertical navigation a doddle.
lloydi is offline   Reply With Quote
Old Aug 10, 2007, 07:56   #11
junjun
Object Not Found
 
junjun's Avatar
 
Join Date: Mar 2002
Location: northern MI
Posts: 1,468
A great resource I use is Listamatic http://css.maxdesign.com.au/listamatic/ Seems like some of the examples here is taken from there so it's worth a visit.
junjun is offline   Reply With Quote
Old Aug 10, 2007, 11:22   #12
Dan Schulz
In memoriam
SitePoint Award Recipient
 
Dan Schulz's Avatar
 
Join Date: May 2006
Location: Aurora, Illinois
Posts: 15,648
Quote:
Originally Posted by Stormrider View Post
Why would you put a <div id="navigation"> around the <ul> in the first example, when <ul id="navigation"> would work just as well?
Thank you. I meant to say that yesterday, but had to run.

Furthermore, I'd change "navigation" to "menu" but that's just a personal choice.
Dan Schulz is offline   Reply With Quote
Old Aug 12, 2007, 17:57   #13
Bling
SitePoint Zealot
 
Join Date: Oct 2004
Location: Sydney, Australia
Posts: 175
If you want a css drop down that works in IE6 checkout http://tutorials.alsacreations.com/deroulant/menu-horizontal.htm
Bling is offline   Reply With Quote
Old Aug 12, 2007, 18:09   #14
markbrown4
padawan
 
markbrown4's Avatar
 
Join Date: Jul 2006
Location: Victoria, Australia
Posts: 2,734
Bling, there's better options for dropdown menus than that,
http://www.htmldog.com/articles/suckerfish/

Anything that suggest inline javascript like onmouseover="javascript:montre();" is out of date.

Keep the content / presentation and beharioural layers completely separate.
markbrown4 is online now   Reply With Quote
Old Aug 12, 2007, 22:08   #15
Tyssen
SitePoint Wizard
 
Tyssen's Avatar
 
Join Date: Oct 2005
Location: Brisbane, QLD
Posts: 4,008
Quote:
Originally Posted by lloydi View Post
http://www.accessify.com/tools-and-wizards/developer-tools/list-o-matic/
I like it.
Tyssen is offline   Reply With Quote
Old Aug 14, 2007, 05:07   #16
Rimantas
SitePoint Community Guest
 
Posts: n/a
that wrapping div is unnecessary, you can have id attribute for the ul itself.
  Reply With Quote
Old Aug 14, 2007, 08:46   #17
Drinky
SitePoint Hero
 
Drinky's Avatar
 
Join Date: Jan 2001
Location: England
Posts: 339
Lots of occurences of
Code:
& # 8 9 4 2 ;
throughout that article's code samples

Last edited by Drinky; Aug 15, 2007 at 07:59.
Drinky is offline   Reply With Quote
Old Aug 15, 2007, 14:03   #18
aarontgrogg
SitePoint Member
 
Join Date: Jul 2007
Location: New York, NY
Posts: 12
Quote:
"However, this approach doesn't work in Internet Explorer"
i think i might have put this phrase a little higher in the article...

like maybe in the first sentence?

but good article otherwise...
aarontgrogg is offline   Reply With Quote
Old Aug 15, 2007, 18:29   #19
mattymcg
Team SitePoint
 
mattymcg's Avatar
 
Join Date: Oct 2005
Location: Melbourne, Australia
Posts: 566
Thanks Drinky, not sure what happened there. All fixed.
mattymcg is offline   Reply With Quote
Old Aug 16, 2007, 20:37   #20
thenk83
SitePoint Enthusiast
 
thenk83's Avatar
 
Join Date: Sep 2005
Location: Hacienda Heights, CA
Posts: 51
Skimming through the article, This will be useful in my collection of bookmarks :) I love the idea of CSS menus without Javascript.
thenk83 is offline   Reply With Quote
Old Aug 17, 2007, 00:43   #21
james
SitePoint Community Guest
 
Posts: n/a
Cool article!
  Reply With Quote
Old Aug 20, 2007, 20:05   #22
Nathan Hein
SitePoint Community Guest
 
Posts: n/a
Many many good techniques here though nothing really new or revolutionary. Plus pure CSS drop downs are pointless without IE 6 support.
Nice job spreading the word on these techniques though.
  Reply With Quote
Old Aug 20, 2007, 22:59   #23
loganathan
SitePoint Member
 
loganathan's Avatar
 
Join Date: Nov 2005
Location: Vellore-Chennai-TN
Posts: 15
it is great one to know about more on css
loganathan is offline   Reply With Quote
Old Aug 23, 2007, 06:17   #24
Stevie D
SitePoint Addict
 
Join Date: Mar 2006
Posts: 213
A really good article, thanks!

A few things to add...

The technique you use to give flyout or drop-down menus can be enhanced by the use of Javascript to make it work in IE6 - detailed in http://www.alistapart.com/articles/dropdowns/.
What this does is uses Javascript to apply a class to the sublist when you 'mouseover' the parent element, and to remove the class onMouseOut. This gives the same effect in IE6 as using :hover does in better browsers.

If you're going to make it really accessible, of course, you should repeat it for onFocus/onBlur so that keyboard users (on any browser) can access the submenus.

Another good thing to do is linked in with the technique of using <body id=...> to style the current tab - you can also use <body class=...> to make the current submenu always visible.

ie, if you had a page on menus in the CSS section of your site, you might have, within your menu:

...
<li id="css">CSS
<ul><li id="menus">Menus</li>
...</ul>
</li>
...

then at the top, have <body id="menus" class="css">.

You can then use CSS to keep the relevant submenu on the screen at all times,
eg

body.css ul#nav li#css ul {
display:block; padding-left:12px;
(other display styles) }

Specificity rules mean that this should override the :hover declaration. Obviously, you can apply the one declaration to all the different submenus by repeating the element line and swapping "css" for the names of the other submenus.

Disclaimer - this is all off the top of my head and may have one or two unforeseen bugs in the implementation. But the general principle is sound!
Stevie D is offline   Reply With Quote
Old Sep 3, 2007, 16:09   #25
tonybone
SitePoint Enthusiast
 
Join Date: Feb 2006
Posts: 61
I was working with the simple horizontal menu example and noticed that, in IE 7, the bottom padding of the links weren't being rendered, so the buttons looked like the bottoms were 'cut off' (no problems in FF). Anyone else see this and/or know how to fix it?
tonybone is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 14:16.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved