Add "option" to list elements that belong to "listbox"

The accessibility attribute `role="listbox"` requires its immediate children to be set as `role="option"`, currently they don't have this option and accessibility tests are failing.
This commit is contained in:
Ramon Lapenta 2020-03-10 11:10:04 -06:00
parent 667495eaf9
commit 9c7eac481e
4 changed files with 4 additions and 2 deletions

View File

@ -90,6 +90,7 @@ class CheckboxSetField extends MultiSelectField
$options->push(new ArrayData(array(
'ID' => $itemID,
'Class' => $extraClass,
'Role' => 'option',
'Name' => "{$this->name}[{$itemValue}]",
'Value' => $itemValue,
'Title' => $title,

View File

@ -72,6 +72,7 @@ class OptionsetField extends SingleSelectField
return new ArrayData(array(
'ID' => $this->getOptionID($value),
'Class' => $this->getOptionClass($value, $odd),
'Role' => 'option',
'Name' => $this->getOptionName(),
'Value' => $value,
'Title' => $title,

View File

@ -1,7 +1,7 @@
<ul $AttributesHTML>
<% if $Options.Count %>
<% loop $Options %>
<li class="$Class">
<li class="$Class" role="$Role">
<input id="$ID" class="checkbox" name="$Name" type="checkbox" value="$Value.ATT"<% if $isChecked %> checked="checked"<% end_if %><% if $isDisabled %> disabled="disabled"<% end_if %> />
<label for="$ID">$Title</label>
</li>

View File

@ -1,6 +1,6 @@
<ul $AttributesHTML>
<% loop $Options %>
<li class="$Class">
<li class="$Class" role="$Role">
<input id="$ID" class="radio" name="$Name" type="radio" value="$Value"<% if $isChecked %> checked<% end_if %><% if $isDisabled %> disabled<% end_if %> <% if $Up.Required %>required<% end_if %> />
<label for="$ID">$Title</label>
</li>