tab键和伪类选择器 [英] tab key and pseudo class selector

查看:88
本文介绍了tab键和伪类选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个下拉菜单系统,包含两个中的许多条目,分别为
四个等级。由于菜单的大小和复杂性,我将

用户悬停在菜单列表项上以使其子菜单可见。


这样工作正常,但我希望这个行为也完全通过键盘实现

。要做到这一点,我已经在文本

字符串中启用了Tab键,将它们放入空锚元素中。因此,当我向列表项文本添加
选项卡时,它会显示其子菜单。


这是一个缩写和简洁的标记来显示我的内容意思是:


< ul>

< li>< a href ="" id =" a"> Top Heading< / a>

< ul id =" list-a">

< li>< a ACCESSKEY = QUOT; A" href ="< path>"> a)副标题< / a>< / li>

< li>< a accesskey =" b" href ="< path>"> b)副标题< / a>< / li>

...


< style> ;

a #a:focus + ul#list-a,a #a:active + ul#list -a {display:block; }

< / style>


当用户显示子菜单时,他可以点击它导航到

< pathpage。但是,我想从键盘上的

复制此操作。传统的方法是使用accesskey属性(

我已在上面的例子中通过插图实现)。但是,

使用访问键的字母与浏览器热键冲突,而不是所有浏览器(包括我的firefox / iceweasel)都响应数字。


我在上面看到子菜单的方法有什么问题吗?是

有没有办法选择和激活一个菜单,链接到另一个页面

,而不是通过tabbing到达那里,这对于
$来说太麻烦了b $ b大型综合菜单。


---

Haines Brown,KB1GRM

解决方案

Scripsit Haines Brown:


我有一个下拉菜单系统,包含两个中的多个条目

四级。



您最有可能重新设计它。听起来好像可用性差而且b $ b和可访问性差,而且这种菜单系统经常引起抱怨。


由于菜单的大小和复杂性,我有

用户将鼠标悬停在菜单列表项上以使其子菜单可见。



只是简单一点,然后保持简单,mm''ay?


这很好用,但我希望这个行为也完全通过键盘实现




所以你现在试图通过设置一个过于复杂的菜单系统找到你创建的一些问题的部分修复



为了做到这一点,我已经在文本

字符串中启用了Tab键,将它们放入空锚元素中。



变得更糟。您故意破坏页面的可用性和

可访问性。


< li>< a accesskey =" a" href ="< path>"> a)副标题< / a>< / li>



为了促进可访问性而名义上引入的accesskey属性,已发现
对可访问性具有敌意性。上面的设置

通常会在浏览器中掩盖Alt + A的功能,而你

不可能知道造成了什么损坏(即,哪个功能,如果有的话) ,

被掩盖了。


但是,

使用字母表示访问键与浏览器热键冲突,而不是

所有浏览器(包括我的firefox / iceweasel)都会响应数字。



确实。


和使用的想法:焦点不会带你走远,因为它是

在不同的浏览器中不一致地实现。


我的方法是否在上面显示子菜单有什么问题?



是的,整个想法都是错误的。在合理设计之前讨论CSS细节

是毫无意义的。


单个下拉菜单,通过CSS以降低的方式实现/>
优雅,可能是合理的。也许你可以在一个页面上有几个这样的

菜单,但不要试图嵌套它们。 A $ / $

-

Jukka K. Korpela(Yucca)
http://www.cs.tut.fi/~jkorpela/


" Jukka K. Korpela" < jk ****** @ cs.tut.fiwrites:


Scripsit Haines Brown:


>我有一个下拉菜单系统,包含两个到四个级别的许多条目。



您最有可能重新设计它。这听起来像是可怜的可用性

和糟糕的可访问性,而且这样的菜单系统经常引起抱怨。



我很感激你的其他观点,但我想关注这一点,如果你允许

,大部分时间你说的其余部分都是从它开始的。


我的假设是,在可用性方面,三个级别是

通常是级联菜单的最大深度。你不同意

这种普遍性吗?


当然,一个人必须考虑到预期的用户群。在这种情况下,我的

用户是有动力挖掘材料的人。并且

我也不会处于竞争激烈的竞争环境中,竞争对手的网站使用起来比使用它更有利于他们。


菜单系统的优势在于将图形组织材料

分类和子类别,引导用户进入他的最终目的地。我不能想到任何其他方法,那就是b $ b。但如果你能想到,我会很高兴知道它。


原则上我可以实现一个搜索引擎并确保每个

目标网页< meta name =" keywords" ..配有一个单词

对应每个分类级别。但是,那不是真的好工作。


-


Haines Brown,KB1GRM


文章< 87 ************ @ teufel.hartford-hwp.com>,

Haines Brown< br **** @ teufel.hartford-hwp.comwrote:


" Jukka K. Korpela" < jk ****** @ cs.tut.fiwrites:


Scripsit Haines Brown:


我有一个下拉菜单系统,包含两个

到四个级别的许多条目。



您最有可能重新设计它。这听起来像是可怜的可用性

和糟糕的可访问性,而且这样的菜单系统经常引起抱怨。



我很感激你的其他观点,但我想关注这一点,如果你允许

,大部分时间你说的其余部分都是从它开始的。


我的假设是,在可用性方面,三个级别是

通常是级联菜单的最大深度。你不同意

的一般性吗?



是的。级别(即使是一个 - 但这是最​​安全的)会增加可访问性。


当然,一个人必须考虑预期的用户群。在这种情况下,我的

用户是有动力挖掘材料的人。



每个人都在寻找材料。驱动人类。


菜单系统具有图形化组织材料的巨大优势

到类别和子类别,引导用户走向他的

终极目的地。



理论上,也许吧。但考虑到它们在实践中遇到的麻烦,考虑到技术和浏览器的差异,转向替代品会更好。

。这并不是没有优秀的

替代品。


我不能想到任何其他方法相当
就是这么做的。但如果你能想到,我会很高兴知道它。


原则上我可以实现一个搜索引擎并确保每个

目标网页< meta name =" keywords" ..配有一个单词

对应每个分类级别。但是,这并不是真的好工作。



搜索引擎有什么问题?为什么它不能真正起作用?


无论如何,你可以有一个站点地图。你可以仔细选择你的顶级类别

,以便毫无疑问一个人想要知道关于鸭子的
将会点击一个链接,这将导致鸭子(链接可能go

到一个页面上有一个名为Birds are to eat的突出链接。)


您可能会认为这对用户来说效率低下?为什么?如果,因为他的网站authopr没有很好的计划,一般的

智能用户可以很容易地进入flase链接路径,所以他也可以继续

false在一个页面上放下路径,摆弄和摸索

鼠标并错过确切的2个等级并且不得不开始所有
结束等等。


追求可靠性。如果你必须有一个下拉,JK的建议是好的。

不超过一个级别。


我会忘记下降正如你可以为以下

理由:它使作者懒惰的意思,关于逻辑排序

的页面和标题和标题以及所有与良好的关系

管理。下降可能就像是一个好的和更深层次的坏的替代品。

组织一个网站。


-

dorayme


I have a drop down menu system that consists of many entries in two to
four levels. Because of the size and complexity of the menu, I have the
user hover over a menu list item to make its submenu visible.

This works fine, but I''d like to have this behavior also implemented
entirely from the keyboard. To do this I''ve enabled tabbing among text
strings by placing them into empty anchor elements. As a result, when I
tab to a list item text, it makes its submenu visible.

Here is an abbreviated and simplied markup to show what I mean:

<ul>
<li><a href="" id="a">Top Heading</a>
<ul id="list-a">
<li><a accesskey="a" href="<path>">a) Subheading</a></li>
<li><a accesskey="b" href="<path>">b) Subheading</a></li>
...

<style>
a#a:focus + ul#list-a, a#a:active + ul#list-a { display: block; }
</style>

When the user displays the submenu, he can click on it to navigate to
the <pathpage. However, I''d like to duplicate this operation from the
the keyboard. The traditional way was to use accesskey property (which
I''ve implemented in the example above by way of illustration). However,
using letters for access keys conflicts with browser hot keys, and not
all browsers (including my firefox/iceweasel) respond to digits.

Is there anything wrong with my way to make submenus visible above? Is
there any way to select and activate a menu that links to a page other
than getting there simply by tabbing, which is too cumbersome for a
large complex menu.

---
Haines Brown, KB1GRM

解决方案

Scripsit Haines Brown:

I have a drop down menu system that consists of many entries in two to
four levels.

You should most probably redesign it. That sounds like poor usability
and poor accessibility, and such menu systems are a frequent cause of
complains.

Because of the size and complexity of the menu, I have
the user hover over a menu list item to make its submenu visible.

Just make it simple, then keep it simple, mm''kay?

This works fine, but I''d like to have this behavior also implemented
entirely from the keyboard.

So you are now trying to find partial fixes to some problems you created
by setting up an overly complex menu system.

To do this I''ve enabled tabbing among text
strings by placing them into empty anchor elements.

Gets even worse. You are intentional breaking the usability and the
accessibility of the pages.

<li><a accesskey="a" href="<path>">a) Subheading</a></li>

The accesskey attribute, nominally introduced to promote accessibility,
has been found to be hostile to accessibility. The setting above will
normally mask out the functionality of Alt+A in a browser, and you
cannot possibly know what damage is done (i.e., which function, if any,
is masked out).

However,
using letters for access keys conflicts with browser hot keys, and not
all browsers (including my firefox/iceweasel) respond to digits.

Indeed.

And the idea of using :focus won''t take you far, since it is
inconsistently implemented in different browsers.

Is there anything wrong with my way to make submenus visible above?

Yes, the whole idea is wrong. It''s pointless to discuss CSS details
before having a reasonable design.

A single dropdown menu, implemented via CSS in a manner that degrades
gracefully, might be reasonable. And perhaps you can have several such
menus on a page, but don''t try to nest them. A

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


"Jukka K. Korpela" <jk******@cs.tut.fiwrites:

Scripsit Haines Brown:

>I have a drop down menu system that consists of many entries in two
to four levels.


You should most probably redesign it. That sounds like poor usability
and poor accessibility, and such menu systems are a frequent cause of
complains.

I appreciate your other points, but I''d like to focus on this one, if
you allow, for much of the rest of what you say follows from it.

It was my assumption that, in terms of usability, three levels are
normally the maximum depth for cascading menus. Are you disagreeing with
that generality?

One, of course, has to take into account the intended user base. My
users in this case are people who are motivated to dig for material. And
I''m also not in a competitive situation where competing sites'' greater
ease of use would give them an advantage over me.

A menu system has the great advantage of graphically organizing material
into categories and subcategories that guide the user toward his
ultimate destination. I can''t think of any other approach that quite
does that. But if you can think of any, I''d appreciate knowing of it.

In principle I could implement a search engine and make sure that each
target page <meta name="keywords" ..is equipped with a word
corresponding to each categorical level. However, that wouldn''t really
work.

--

Haines Brown, KB1GRM


In article <87************@teufel.hartford-hwp.com>,
Haines Brown <br****@teufel.hartford-hwp.comwrote:

"Jukka K. Korpela" <jk******@cs.tut.fiwrites:

Scripsit Haines Brown:

I have a drop down menu system that consists of many entries in two
to four levels.

You should most probably redesign it. That sounds like poor usability
and poor accessibility, and such menu systems are a frequent cause of
complains.


I appreciate your other points, but I''d like to focus on this one, if
you allow, for much of the rest of what you say follows from it.

It was my assumption that, in terms of usability, three levels are
normally the maximum depth for cascading menus. Are you disagreeing with
that generality?

Yes. Levels (even one - but that is safest) buggers up accessibility.

One, of course, has to take into account the intended user base. My
users in this case are people who are motivated to dig for material.

Everyone digs for material. Humans are driven.

A menu system has the great advantage of graphically organizing material
into categories and subcategories that guide the user toward his
ultimate destination.

In theory, maybe. But considering the troubles they run into in
practice, given the technologies and browser differences, it is better
to turn to alternatives. It is not as if there are not excellent
alternatives.

I can''t think of any other approach that quite
does that. But if you can think of any, I''d appreciate knowing of it.

In principle I could implement a search engine and make sure that each
target page <meta name="keywords" ..is equipped with a word
corresponding to each categorical level. However, that wouldn''t really
work.

What quite is wrong with a search engine? Why would it not really work?

Anyway, you can have a site map. You can choose your top categories
carefully so that there is little doubt that a person wanting to know
about ducks will click a link that will lead to ducks (the link might go
to a page that has a prominent link called "Birds good to eat").

You might suppose that this is inefficient for the user? Why? If,
because he authopr of the site has not planned well, the average
intelligent user can easily go on flase link trails, so too can he go on
false drop down pathways on a single page, fiddling and fumbling with
mouse and missing the exact spot 2 levels down and having to start all
over and so on.

Go for reliability. If you must have a drop down, JK''s advice is good.
No more than a level.

I would forget about drop downs as much as you can for the following
reason: it makes the author lazy about meaning, about logical ordering
of pages and heading and titles and everything to do with good
management. Drop downs can be like bad substitutes for good and deeper
organization of a site.

--
dorayme


这篇关于tab键和伪类选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆