aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/scripts
diff options
context:
space:
mode:
authorAndreas Gohr <gohr@cosmocode.de>2018-03-28 14:25:44 +0200
committerAndreas Gohr <gohr@cosmocode.de>2018-03-28 14:25:44 +0200
commit2171f9cb4ef0f6e16e4bfe0548d2383544c0198f (patch)
treec0d5e8a2305d0173c97c2b5e4d3c47fdd4a74002 /lib/scripts
parent1d9188934097ce146831500635ba4869b23d1a44 (diff)
downloaddokuwiki-2171f9cb4ef0f6e16e4bfe0548d2383544c0198f.tar.gz
dokuwiki-2171f9cb4ef0f6e16e4bfe0548d2383544c0198f.zip
added aria attributes
Diffstat (limited to 'lib/scripts')
-rw-r--r--lib/scripts/search.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/scripts/search.js b/lib/scripts/search.js
index b11aff755..c6171256f 100644
--- a/lib/scripts/search.js
+++ b/lib/scripts/search.js
@@ -7,12 +7,21 @@ jQuery(function () {
}
const $toggleAssistanceButton = $searchForm.find('button.toggleAssistant');
- if (!$toggleAssistanceButton.length){
+ if (!$toggleAssistanceButton.length) {
return;
}
$toggleAssistanceButton.on('click', function () {
- jQuery('.advancedOptions').toggle();
+ jQuery('.advancedOptions').toggle(0, function () {
+ var $me = jQuery(this);
+ if ($me.attr('aria-hidden')) {
+ $me.removeAttr('aria-hidden');
+ $toggleAssistanceButton.attr('aria-expanded', 'true');
+ } else {
+ $me.attr('aria-hidden', 'true');
+ $toggleAssistanceButton.attr('aria-expanded', 'false');
+ }
+ });
DokuCookie.setValue('sa', !DokuCookie.getValue('sa'));
});
@@ -20,10 +29,16 @@ jQuery(function () {
$toggleAssistanceButton.click();
}
- $searchForm.find('.advancedOptions .toggle div.current').on('click', function() {
+ $searchForm.find('.advancedOptions .toggle div.current').on('click', function () {
var $me = jQuery(this);
$me.parent().siblings().removeClass('open');
+ $me.parent().siblings().find('ul:first').attr('aria-expanded', 'false');
$me.parent().toggleClass('open');
+ if ($me.parent().hasClass('open')) {
+ $me.parent().find('ul:first').attr('aria-expanded', 'true');
+ } else {
+ $me.parent().find('ul:first').attr('aria-expanded', 'false');
+ }
});
});