From 61c62fae90647dc06975cdbde6a9a672bcdd6d0d Mon Sep 17 00:00:00 2001 From: Viola Elsenhans <elsenhans@ub.uni-leipzig.de> Date: Mon, 21 Aug 2023 17:37:09 +0200 Subject: [PATCH] refs #24358 [finc] simplify setting aria-describedby --- .../templates/RecordDriver/DefaultRecord/result-list.phtml | 3 ++- .../finc/templates/RecordDriver/DefaultRecord/toolbar.phtml | 3 +-- themes/finc/templates/RecordDriver/SolrAI/result-list.phtml | 3 ++- themes/finc/templates/record/cart-buttons.phtml | 6 +++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/result-list.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/result-list.phtml index 3f3e2d21a6e..c5f6bf12ef8 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/result-list.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/result-list.phtml @@ -221,7 +221,8 @@ if ($cover): <?php if ($this->cart()->isActiveInSearch() && isset($this->params) && $this->params->getOptions()->supportsCart() && $this->cart()->isActive()): ?> <?php /* finc: remove break after bookbag #22379 */ ?> - <?=$this->render('record/cart-buttons.phtml', ['id' => $this->driver->getUniqueId(), 'source' => $this->driver->getSourceIdentifier()]); ?> + <?php /* finc adds callFromTemplate for setting aria-describedby if use of book bag is with checkboxes #24358 */ ?> + <?=$this->render('record/cart-buttons.phtml', ['id' => $this->driver->getUniqueId(), 'source' => $this->driver->getSourceIdentifier(), 'callFromTemplate' => 'resultList']); ?> <?php endif; ?> <?php if ($this->userlist()->getMode() !== 'disabled'): ?> diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/toolbar.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/toolbar.phtml index c1585608ced..fdb24dcec2e 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/toolbar.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/toolbar.phtml @@ -78,8 +78,7 @@ <?php endif; ?> <?php /* finc adds bookbag feature */ ?> <li class="bookbag-menu"> - <?php /* finc adds callFromTemplate to distinguish if use of book bag is with or without checkbox for setting either aria-label or aria-describedby #24358 */ ?> - <?=$this->render('record/cart-buttons.phtml', ['id' => $this->driver->getUniqueId(), 'source' => $this->driver->getSourceIdentifier(), 'callFromTemplate' => 'toolbar' ]); ?> + <?=$this->render('record/cart-buttons.phtml', ['id' => $this->driver->getUniqueId(), 'source' => $this->driver->getSourceIdentifier()]); ?> </li> </ul> </nav> diff --git a/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml b/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml index 17bc7f3cac9..d55926fcf66 100644 --- a/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml +++ b/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml @@ -204,7 +204,8 @@ if ($cover): <?php if ($this->cart()->isActiveInSearch() && isset($this->params) && $this->params->getOptions()->supportsCart() && $this->cart()->isActive()): ?> <?php /* finc: remove break after bookbag #22379 */ ?> - <?=$this->render('record/cart-buttons.phtml', ['id' => $this->driver->getUniqueId(), 'source' => $this->driver->getSourceIdentifier()]); ?> + <?php /* finc adds callFromTemplate for setting aria-describedby if use of book bag is with checkboxes #24358 */ ?> + <?=$this->render('record/cart-buttons.phtml', ['id' => $this->driver->getUniqueId(), 'source' => $this->driver->getSourceIdentifier(), 'callFromTemplate' => 'resultList' ]); ?> <?php endif; ?> <?php if ($this->userlist()->getMode() !== 'disabled'): ?> diff --git a/themes/finc/templates/record/cart-buttons.phtml b/themes/finc/templates/record/cart-buttons.phtml index c9388056d58..abb7910f42d 100644 --- a/themes/finc/templates/record/cart-buttons.phtml +++ b/themes/finc/templates/record/cart-buttons.phtml @@ -5,11 +5,11 @@ <?php /* finc changes span to div */ ?> <div class="btn-bookbag-toggle" data-cart-id="<?=$this->escapeHtmlAttr($this->id)?>" data-cart-source="<?=$this->escapeHtmlAttr($this->source)?>"> <?php /* finc makes add-to/remove-from bookbag accessible for keyboard navigation - CK */ ?> - <?php /* finc uses callFromTemplate to distinguish if use of book bag is with or without checkbox for setting either aria-label or aria-describedby #24358 */ ?> - <a href="javascript:" class="cart-add hidden<?php if (!$cart->contains($cartId)): ?> correct<?php endif ?>" <?php if ($this->callFromTemplate === 'toolbar'): ?>aria-describedby="<?=$cartId?>"<?php else: ?>aria-describedby="<?=$cartId?>"<?php endif ?>> + <?php /* finc adds callFromTemplate for setting aria-describedby if use of book bag is with checkboxes #24358 */ ?> + <a href="javascript:" class="cart-add hidden<?php if (!$cart->contains($cartId)): ?> correct<?php endif ?>" <?php if ($this->callFromTemplate == 'resultList'): ?>aria-describedby="<?=$cartId?>"<?php endif ?>> <span class="cart-link-label btn-type-add"><?=$this->transEsc('Add to Book Bag')?></span> </a> - <a href="javascript:" class="cart-remove hidden<?php if ($cart->contains($cartId)): ?> correct<?php endif ?>" <?php if ($this->callFromTemplate === 'toolbar'): ?>aria-describedby="<?=$cartId?>"<?php else: ?>aria-describedby="<?=$cartId?>"<?php endif ?>> + <a href="javascript:" class="cart-remove hidden<?php if ($cart->contains($cartId)): ?> correct<?php endif ?>" <?php if ($this->callFromTemplate == 'resultList'): ?>aria-describedby="<?=$cartId?>"<?php endif ?>> <span class="cart-link-label btn-type-minus"><?=$this->transEsc('Remove from Book Bag')?></span> </a> -- GitLab