简体   繁体   English

过滤/排序“下拉列表”的可访问性模式是什么?

[英]What accessibility pattern for filter/sort "dropdown"?

I have a design that displays a list of content that you can filter by different categories.我有一个显示内容列表的设计,您可以按不同类别过滤这些内容。 Each filter is displayed in a dropdown menu that lets you choose one or more options, which when activated (either through click or keyboard), will update the results on the page.每个过滤器都显示在一个下拉菜单中,您可以从中选择一个或多个选项,激活后(通过单击或键盘),将更新页面上的结果。 The page url does not change in response to the filter and there is no "submit" button to apply the filter.页面 url 不会响应过滤器而改变,并且没有“提交”按钮来应用过滤器。

在此处输入图像描述

I'm confused which ARIA pattern to use: Menu (with menu/menuitem roles) or Combobox (with listbox/option roles).我对使用哪种 ARIA 模式感到困惑:菜单(具有菜单/菜单项角色)或Combobox (具有列表框/选项角色)。

In my opinion you should go with a combobox .在我看来你应该 go 与combobox

Otherwise, it should be a menubar rather than menu :否则,它应该是一个menubar而不是menu

A menu that is visually persistent is a menubar .视觉持久的菜单是menubar

Managing focus管理重点

Aside from the question which role to use, you need to decide whether to manage focus or not.除了使用哪个角色的问题之外,您还需要决定是否管理焦点。 It is recommended (should) for menu and menubar , which would mean that the whole bar only has one tab stop, and navigation between the single dropdowns is done via arrow keys .建议(应该)用于menumenubar ,这意味着整个栏只有一个制表位,并且单个下拉菜单之间的导航是通过箭头键完成的。

Website or application?网站还是应用程序?

This depends on how much your site feels like an application overall.这取决于您的站点整体上感觉像一个应用程序的程度。 If it's more of a website, keyboard users in general are more accustomed to tabbing than to managed focus.如果它更像是一个网站,那么键盘用户通常更习惯使用 Tab 键而不是管理焦点。 For users it is sometimes a surprise that you need to navigate within components by means of arrow keys.对于用户来说,您需要通过箭头键在组件内导航有时会让他们感到惊讶。

If there are other composite widgets as well that manage focus, you absolutely could do so for this part as well.如果还有其他复合小部件可以管理焦点,那么您绝对也可以对这部分进行管理。

Responsive Design响应式设计

A menubar should allow left and right arrow keys to navigate the filters, and up and down to focus the options.菜单栏应允许左右箭头键导航过滤器,并允许上下箭头键聚焦选项。 Managing focus would get complicated with Responsive Design : Once items wrap, it becomes less obvious how to navigate to them.使用响应式设计管理焦点会变得复杂:一旦项目包装,如何导航到它们就变得不那么明显了。

Actions vs Selections行动与选择

A menu is usually used for actions.菜单通常用于操作。 To quote some references (emphasis mine):引用一些参考资料(强调我的):

A menu is a widget that offers a list of choices to the user, such as a set of actions or functions .菜单是为用户提供选项列表的小部件,例如一组操作或功能

Menu or Menu bar pattern 菜单或菜单栏模式

The WAI ARIA standard defines an actual `nole="menu"' widget, but this is specific to application-like menus which trigger actions or functions . WAI ARIA 标准定义了一个实际的 `nole="menu"' 小部件,但这是特定于触发操作或功能的类似应用程序的菜单

Bootstrap 引导程序

Since the filters only allow choosing options, and not executing commands or functions, I would rather go with combobox .由于过滤器只允许选择选项,而不能执行命令或函数,我宁愿 go 和combobox

Searchability可搜索性

Combobox also implies that it's a flat list of options, maybe grouped. Combobox 也意味着它是一个简单的选项列表,可能是分组的。 This is immediately known.这是立即知道的。 A menu can potentially have sub menus, so it's less clear what to expect when opening a filter list.菜单可能有子菜单,因此不太清楚打开过滤器列表时会发生什么。

Since combobox is a flat list, users can type Printable characters to directly jump to a list item.由于 combobox 是一个平面列表,用户可以键入可打印字符直接跳转到列表项。 This is not the expectation for menus.这不是对菜单的期望。

Show the user's selection显示用户的选择

Since the filters close once a selection is made, it is best practice to display the chosen value or values in the closed item.由于一旦做出选择过滤器就会关闭,因此最佳做法是在已关闭的项目中显示所选的一个或多个值。 Also known as the Visibility of System Status .也称为系统状态的可见性

A combobox will do so, and screen readers would even announce the current choice without opening the list. combobox会这样做,屏幕阅读器甚至会在不打开列表的情况下宣布当前的选择。 A menu does not have that behaviour.菜单没有这种行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM