From 7dc7c047ab169cd3ee6554be2a2f88e35071242a Mon Sep 17 00:00:00 2001 From: Robert Lange <robert.lange@uni-leipzig.de> Date: Tue, 9 Nov 2021 15:08:50 +0100 Subject: [PATCH] refs #20375 [finc] set focus on hierarchy tab * define hierarchy tree tab as ajax-loadable * fix: set aria-controls for ajax tabs just-in-time to avoid reference of aria to unloaded tab-content, also #19938 --- module/finc/src/finc/RecordTab/HierarchyTree.php | 11 +++++++++++ themes/finc-accessibility/js/record.js | 2 ++ themes/finc/templates/record/view.phtml | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/module/finc/src/finc/RecordTab/HierarchyTree.php b/module/finc/src/finc/RecordTab/HierarchyTree.php index 315b773894f..56133533858 100644 --- a/module/finc/src/finc/RecordTab/HierarchyTree.php +++ b/module/finc/src/finc/RecordTab/HierarchyTree.php @@ -67,4 +67,15 @@ class HierarchyTree extends \VuFind\RecordTab\HierarchyTree } return false; } + + /** + * Can this tab be loaded via AJAX? + * + * @return bool + */ + public function supportsAjax() + { + // No, special width adjustment needed. + return true; + } } diff --git a/themes/finc-accessibility/js/record.js b/themes/finc-accessibility/js/record.js index 9766867212c..26da27f6f5f 100644 --- a/themes/finc-accessibility/js/record.js +++ b/themes/finc-accessibility/js/record.js @@ -274,6 +274,8 @@ function recordDocReady() { // accessibility: mark tab controls as selected $top.find('.record-tab.active').find('a').attr('aria-selected', 'false'); + // accessibility: set information about connection between tab control and tab content + $(this).attr('aria-controls', tabid); $('#' + tabid + '-tabselector').attr('aria-selected', 'true').attr('aria-controls', tabid); // accessibility: set aria-hidden for content panes diff --git a/themes/finc/templates/record/view.phtml b/themes/finc/templates/record/view.phtml index 3749c2121c6..076ef6fb512 100644 --- a/themes/finc/templates/record/view.phtml +++ b/themes/finc/templates/record/view.phtml @@ -71,7 +71,7 @@ <a href="<?= $this->recordLink()->getTabUrl($this->driver, $tab) ?>#tabnav" <?php if ($obj->supportsAjax() && in_array($tab, $this->backgroundTabs)): ?> data-background<?php endif ?> aria-selected="<?= $isActiveTab ? "true" : "false" ?>" - aria-controls="<?= $tabName ?>" + <?php if($isActiveTab): ?>aria-controls="<?= $tabName ?>"<?php endif; ?> id="<?= $tabName ?>-tabselector"> <?= $this->transEsc($desc) ?> <span class="sr-only load-tab-content"><?= $this->transEsc('load_tab_content_hint') ?></span></a> -- GitLab