mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-78885 aria: Add support for data-short-text
This commit is contained in:
parent
7fa36e6bf0
commit
a320dff736
@ -27,7 +27,7 @@
|
||||
"name": "Foo bar"
|
||||
}
|
||||
}}
|
||||
<li id="result-{{id}}" class="w-100 dropdown-item d-flex px-0 align-items-center" role="option" data-value="{{id}}" aria-label="{{$arialabel}}{{#str}}viewresults, core, {{name}}{{/str}}{{/arialabel}}">
|
||||
<li id="result-{{id}}" class="w-100 dropdown-item d-flex px-0 align-items-center" role="option" data-short-text="{{$shorttext}}{{/shorttext}}" data-value="{{id}}" aria-label="{{$arialabel}}{{#str}}viewresults, core, {{name}}{{/str}}{{/arialabel}}">
|
||||
{{$content}}
|
||||
<span class="d-block w-100 px-2 text-truncate">
|
||||
{{name}}
|
||||
|
2
theme/boost/amd/build/aria.min.js
vendored
2
theme/boost/amd/build/aria.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -378,9 +378,9 @@ const comboboxFix = () => {
|
||||
}
|
||||
|
||||
if (combobox.hasAttribute('value')) {
|
||||
combobox.value = option.textContent.replace(/[\n\r]+|[\s]{2,}/g, ' ').trim();
|
||||
combobox.value = option.dataset.shortText || option.textContent.replace(/[\n\r]+|[\s]{2,}/g, ' ').trim();
|
||||
} else {
|
||||
combobox.textContent = option.textContent;
|
||||
combobox.textContent = option.dataset.shortText || option.textContent;
|
||||
}
|
||||
|
||||
if (combobox.dataset.inputElement) {
|
||||
|
@ -34,6 +34,7 @@
|
||||
}}
|
||||
{{<core/local/comboboxsearch/resultitem }}
|
||||
{{$arialabel}}{{#str}}viewresults, core, {{fullname}}{{/str}}{{/arialabel}}
|
||||
{{$shorttext}}{{fullname}}{{/shorttext}}
|
||||
{{$content}}
|
||||
<span class="d-block px-2 w-25">
|
||||
{{#profileimageurl}}
|
||||
|
@ -57,7 +57,14 @@
|
||||
{{/results}}
|
||||
{{$selectall}}
|
||||
{{#selectall}}
|
||||
<li id="result-row-0" class="w-100 p-1 border-top bottom-0 position-sticky dropdown-item d-flex small p-3" role="option" data-value="0">
|
||||
<li
|
||||
id="result-row-0"
|
||||
class="w-100 p-1 border-top bottom-0 position-sticky dropdown-item d-flex small p-3"
|
||||
role="option"
|
||||
{{! The data-short-text attribute is provided so that aria.js would use it rather than the whole content. }}
|
||||
data-short-text="{{searchterm}}"
|
||||
data-value="0"
|
||||
>
|
||||
{{#str}}viewallresults, core, {{matches}}{{/str}}
|
||||
</li>
|
||||
{{/selectall}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user