markdown 改进子菜单导航的键盘可访问性

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 改进子菜单导航的键盘可访问性相关的知识,希望对你有一定的参考价值。

In this lesson, we are going to use the :focus-within pseudo class as a CSS only way improve the accessibility of a navigation menu.
If I were to use :focus on the `<li>`, it wouldn't work because the list items have a tabindex of -1.

:focus-within represents an element that has received focus or contains an element that has received focus. So when it's child, the anchor, receives focus, we can use the same thing that we do on the hover effect. Be wary of browser support though!

If you have to support IE and Edge check out other lessons: 'Expand a Menu on a Focus Event to Improve Accessibility' and 'Collapse a Submenu on the Blur Event to Improve accessibility'

以上是关于markdown 改进子菜单导航的键盘可访问性的主要内容,如果未能解决你的问题,请参考以下文章

如何在键盘可访问性焦点上关闭汉堡菜单

如何获得可访问性滑动以正确导航子视图集合?

两个 div 和 div 子元素之间的键盘箭头导航

键盘可访问性:跳过交互式表格中的内容

可访问的 CSS 下拉菜单 [关闭]

UIView 可访问性问题