[whatwg] accesskey attribute with display:none elements

Calogero Alex Baldacchino alex.baldacchino at email.it
Tue Nov 25 16:34:35 PST 2008


Olli Pettay ha scritto:
> On 11/25/2008 11:17 PM, Calogero Alex Baldacchino wrote:
> > Maybe, the standard behaviour (for both 'display:none' and
> > 'visibility:hidden') could be just focusing (and changing visibility)
> > after pressing the access key (so the user notices what's happening
> > before activating any 'control'), then activating the element after a
> > second press.
> >
>
> That isn't what any of the browsers do currently, so I'm not in favor of
> this pretty strange behavior.
> And how could the browser know how to change the display value?
> From display:none to display:inline or display:block or 
> display:inline-block or what?
Maybe I've replied to quickly, sorry for this. The user agent should 
have a default style sheet with a default display value for each 
element, so that value could apply (this may lead to unwanted results if 
the element had a different display value before the value "none" was 
set, and this case should be handled by script). I guess what you wish 
is something like a shortcut in a desktop application, letting you 
access any control in a menu without showing and esploring the menu. 
Despite this could be a desireable behaviour for a web application, I 
think it could also be used to trick the user, or cause an unwanted 
operation to be performed as a consequence of a casual key pressing, 
thus the idea of showing the control before activating it, giving the 
user a chance to stop the operation. For the possible tricks, I guess 
that might be a minor concern (since there are far 'better' ways to 
compromise your navigation); anyway, consider that an element constraint 
with 'display:none' is not a part of the formatting structure for any 
media and you cannot access it anyway (i.e. you cannot click on it, you 
cannot reach it by pressing the tab key). That's not just invisible, 
that's not presented to you at all, almost if that wasn't in the 
document tree, so that's not focusable at all, and accessing it through 
an access key would be quite a tricky way to bypass the above 
'restrictions' (as if that was forced into the document layout). A 
better way to do what you aim would consist of setting a listener for 
key events on a displayable element and choosing a different operation 
basing on the pressed key(s); a perhaps tricky alternative would be 
using controls with an accesskey attribute properly set and 'emulating' 
the 'display:none' layout property by setting their width, height, 
margin, etc., to a value of zero, and their display property to the 
'inline' value. I guess any browser allowing the behaviour you ask for 
any element with a 'display:none' value perhaps just works around a 
somewhat misuse of the display property as a quirk.
 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Incontri con Meetic : Primo sito d'incontri in Europa - Milioni di single !
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8293&d=26-11



More information about the whatwg mailing list