[英]How can I set ARIA HTML tags for combobox items in Java - Wicket?
I need to add tag 'role="menuitem"' to items generated by Wicket in a drop-down field. 我需要在下拉字段中将标记'role =“ menuitem”'添加到Wicket生成的项目中。 I believe that tags for the combo-box itself can be set with onComponentTag, but I have no idea whether it could be applied to the menu items (
<ul><li><a>
...) themselves. 我相信可以使用onComponentTag设置组合框本身的标签,但是我不知道是否可以将其应用于菜单项(
<ul><li><a>
...)本身。
as said by oh-god-spiders DropDownChoice is designed to work with <select>
and <option>
tags. 如oh-god-spiders所说,DropDownChoice旨在与
<select>
和<option>
标记一起使用。 For a ARIA menu componet ListView
might be a better choice. 对于ARIA菜单,最好使用
ListView
组件。 In any case, if you want to enrich DropDownChoice
options you could override setOptionAttributes
method and add the desired attribute. 无论如何,如果您想丰富
DropDownChoice
选项,则可以覆盖setOptionAttributes
方法并添加所需的属性。 For example: 例如:
@Override
protected void setOptionAttributes(AppendingStringBuffer buffer, E choice, int index, String selected)
{
super.setOptionAttributes(buffer, choice, index, selected);
buffer.append("role=\"menuitem\" ");
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.