From 4e245fd85cc057a14f6f0d42665c61d42b650215 Mon Sep 17 00:00:00 2001 From: Alexander Purr <purr@ub.uni-leipzig.de> Date: Thu, 19 Nov 2020 10:17:31 +0100 Subject: [PATCH] refs #18016 [finc] fix accessibility for select elements * add submit button to page limit and sorting form on result lists (and favorites) ** no automatic page reload on selection change ** therefore no focus changing * language selection form ** change language link into submit button ** still using js for setting language value before submitting --- themes/finc/templates/header.phtml | 22 +++++++++---------- .../templates/search/controls/limit.phtml | 6 +++-- .../finc/templates/search/controls/sort.phtml | 6 +++-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/themes/finc/templates/header.phtml b/themes/finc/templates/header.phtml index b2019c53f1f..fc370fe70a5 100644 --- a/themes/finc/templates/header.phtml +++ b/themes/finc/templates/header.phtml @@ -102,21 +102,19 @@ <li class="language dropdown"> <form method="post" name="langForm" id="langForm"> <input type="hidden" name="mylang"/> - </form> - <a href="#" class="btn dropdown-toggle <?=(count($this->layout()->allLangs) == 2) ? ' hidden' : ''?>" data-toggle="dropdown" aria-controls="langmenu" aria-expanded="false"> <?=$this->transEsc("Language")?> <strong class="caret"></strong> </a> - - <ul id="langmenu" class="dropdown-menu <?=(count($this->layout()->allLangs) == 2) ? ' oneLanguage' : ''?>"> - <?php foreach ($this->layout()->allLangs as $langCode => $langName): ?> - <?php if ($langCode !== $this->layout()->userLang) : ?> - <li> - <a class="btn <?=(count($this->layout()->allLangs) == 2) ? ' btn-secondary' : ''?>" href="#" onClick="document.langForm.mylang.value='<?=$langCode?>';document.langForm.submit()"><?=$this->displayLanguageOption($langName)?></a> - </li> - <?php endif; ?> - <?php endforeach; ?> - </ul> + <ul id="langmenu" class="dropdown-menu <?=(count($this->layout()->allLangs) == 2) ? ' oneLanguage' : ''?>"> + <?php foreach ($this->layout()->allLangs as $langCode => $langName): ?> + <?php if ($langCode !== $this->layout()->userLang) : ?> + <li> + <button type="submit" class="btn <?=(count($this->layout()->allLangs) == 2) ? ' btn-secondary' : ''?>" href="#" onClick="document.langForm.mylang.value='<?=$langCode?>';document.langForm.submit()"><?=$this->displayLanguageOption($langName)?></button> + </li> + <?php endif; ?> + <?php endforeach; ?> + </ul> + </form> </li> <?php endif; ?> </ul> diff --git a/themes/finc/templates/search/controls/limit.phtml b/themes/finc/templates/search/controls/limit.phtml index 9284b184791..dd5d27f2d95 100644 --- a/themes/finc/templates/search/controls/limit.phtml +++ b/themes/finc/templates/search/controls/limit.phtml @@ -5,12 +5,14 @@ <form class="limit" action="<?=$this->currentPath() . $this->results->getUrlQuery()->setLimit(null)?>" method="post"> <label for="limit"><?=$this->transEsc('Results per page')?></label> <?php /* finc: DO NOT use class 'form-control' as it messes up the select box */ ?> - <select id="limit" name="limit" class="jumpMenu"> + <select id="limit" name="limit"> <?php foreach ($limitList as $limitVal => $limitData): ?> <option value="<?=$this->escapeHtmlAttr($limitVal)?>" <?=$limitData['selected']? ' selected="selected" ':'' ?>><?=$this->escapeHtml($limitData['desc'])?></option> <?php endforeach; ?> </select> - <noscript><input type="submit" value="<?=$this->transEsc("Set")?>" /></noscript> + <button type="submit" class="btn btn-primary" aria-label="<?=$this->transEsc("Set")?>"> + <i class="fa fa-refresh" aria-hidden="true"></i> + </button> </form> <?php endif; ?> <!-- finc: search - controls - limit - END --> diff --git a/themes/finc/templates/search/controls/sort.phtml b/themes/finc/templates/search/controls/sort.phtml index c8a81864758..26689a993f6 100644 --- a/themes/finc/templates/search/controls/sort.phtml +++ b/themes/finc/templates/search/controls/sort.phtml @@ -5,12 +5,14 @@ <?=$this->results->getUrlQuery()->asHiddenFields(['sort' => '/.*/']);?> <label for="sort_options_1"><?=$this->transEsc('Sort')?></label> <?php /* finc: DO NOT use class 'form-control' as it messes up the select box */ ?> - <select id="sort_options_1" name="sort" class="jumpMenu"> + <select id="sort_options_1" name="sort"> <?php foreach ($list as $sortType => $sortData): ?> <option value="<?=$this->escapeHtmlAttr($sortType)?>" <?=$sortData['selected']?' selected="selected"':''?>><?=$this->transEsc($sortData['desc'])?></option> <?php endforeach; ?> </select> - <noscript><input type="submit" class="btn btn-primary" value="<?=$this->transEsc("Set")?>" /></noscript> + <button type="submit" class="btn btn-primary" aria-label="<?=$this->transEsc("Set")?>"> + <i class="fa fa-refresh" aria-hidden="true"></i> + </button> </form> <?php endif; ?> <!-- finc: search - controls - sort - END --> -- GitLab