mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
667495eaf9
commit
9c7eac481e
@ -90,6 +90,7 @@ class CheckboxSetField extends MultiSelectField
|
|||||||
$options->push(new ArrayData(array(
|
$options->push(new ArrayData(array(
|
||||||
'ID' => $itemID,
|
'ID' => $itemID,
|
||||||
'Class' => $extraClass,
|
'Class' => $extraClass,
|
||||||
|
'Role' => 'option',
|
||||||
'Name' => "{$this->name}[{$itemValue}]",
|
'Name' => "{$this->name}[{$itemValue}]",
|
||||||
'Value' => $itemValue,
|
'Value' => $itemValue,
|
||||||
'Title' => $title,
|
'Title' => $title,
|
||||||
|
@ -72,6 +72,7 @@ class OptionsetField extends SingleSelectField
|
|||||||
return new ArrayData(array(
|
return new ArrayData(array(
|
||||||
'ID' => $this->getOptionID($value),
|
'ID' => $this->getOptionID($value),
|
||||||
'Class' => $this->getOptionClass($value, $odd),
|
'Class' => $this->getOptionClass($value, $odd),
|
||||||
|
'Role' => 'option',
|
||||||
'Name' => $this->getOptionName(),
|
'Name' => $this->getOptionName(),
|
||||||
'Value' => $value,
|
'Value' => $value,
|
||||||
'Title' => $title,
|
'Title' => $title,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<ul $AttributesHTML>
|
<ul $AttributesHTML>
|
||||||
<% if $Options.Count %>
|
<% if $Options.Count %>
|
||||||
<% loop $Options %>
|
<% 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 %> />
|
<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>
|
<label for="$ID">$Title</label>
|
||||||
</li>
|
</li>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<ul $AttributesHTML>
|
<ul $AttributesHTML>
|
||||||
<% loop $Options %>
|
<% 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 %> />
|
<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>
|
<label for="$ID">$Title</label>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user