Skip to content
3 changes: 2 additions & 1 deletion module/VuFind/src/VuFind/View/Helper/Root/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,9 @@ public function getCheckbox($idPrefix = '', $formAttr = false, $number = null)
{
$id = $this->driver->getSourceIdentifier() . '|'
. $this->driver->getUniqueId();
$titleHtml = $this->getTitleHtml();
$context
= ['id' => $id, 'number' => $number, 'prefix' => $idPrefix];
= ['id' => $id, 'number' => $number, 'prefix' => $idPrefix, 'titleHtml' => $titleHtml];
if ($formAttr) {
$context['formAttr'] = $formAttr;
}
Expand Down
2 changes: 1 addition & 1 deletion themes/bootstrap3/templates/myresearch/checkedout.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<?php if (isset($ilsDetails['renewable']) && $ilsDetails['renewable'] && isset($ilsDetails['renew_details'])): ?>
<?php $safeId = preg_replace('/[^a-zA-Z0-9]/', '', $ilsDetails['renew_details']); ?>
<label>
<input class="checkbox-select-item" type="checkbox" name="renewSelectedIDS[]" value="<?=$this->escapeHtmlAttr($ilsDetails['renew_details'])?>" id="checkbox_<?=$safeId?>" aria-label="<?=$this->transEscAttr('select_item_checked_out_renew')?>">
<input class="checkbox-select-item" type="checkbox" name="renewSelectedIDS[]" value="<?=$this->escapeHtmlAttr($ilsDetails['renew_details'])?>" id="checkbox_<?=$safeId?>" aria-label="<?=$this->escapeHtmlAttr($ilsDetails['title'])?>">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a clean way here to get the record driver, to pass to the Record view helper for getUniqueHtmlElementId. I could use $ilsDetails['item_id'] which in my testing is the same value, but I believe there are cases where that might not be. Alternately maybe I can use $safeId and generate the same value in account-entry.phtml, but I don't know if that adds any value.

If there is not a way to get getUniqueHtmlElementId here, then I should revert the changes to account-entry since they don't have any purpose.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And once we figure out this screen, I can apply the logic to the other account pages with checkboxes.
#3552 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this template, I believe that $resource is the record driver. Does that help?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks! Got this page working with aria-labelledby as well now. Not to presuppose the final decision, but at least the approach is consistent now in this PR for the pages that the Moravian report originally cited.

</label>
<input type="hidden" name="selectAllIDS[]" value="<?=$this->escapeHtmlAttr($ilsDetails['renew_details'])?>">
<input type="hidden" name="renewAllIDS[]" value="<?=$this->escapeHtmlAttr($ilsDetails['renew_details'])?>">
Expand Down
3 changes: 2 additions & 1 deletion themes/bootstrap3/templates/record/checkbox.phtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<label class="record-checkbox hidden-print">
<input class="checkbox-select-item" type="checkbox" name="ids[]" value="<?=$this->escapeHtmlAttr($this->id) ?>"<?php if (isset($this->formAttr)): ?> form="<?=$this->formAttr ?>"<?php endif; ?> aria-label="<?=$this->transEscAttr('select_item')?>">
<?php $title = $this->titleHtml ?? $this->escapeHtmlAttr($driver?->getTitle() ?? $this->id); ?>
<input class="checkbox-select-item" type="checkbox" name="ids[]" value="<?=$this->escapeHtmlAttr($this->id) ?>"<?php if (isset($this->formAttr)): ?> form="<?=$this->formAttr ?>"<?php endif; ?> aria-label="<?=$title ?>">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay for aria-label to include HTML? I think by definition, it's possible that $this->titleHtml will contain markup (e.g. highlighting-related <span>s). While I think it's unlikely that would happen in this particular context, maybe it's worth running a strip_tags on the output just to be on the safe side.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<span class="checkbox-icon"></span>
<?php if (strlen($this->number ?? '') > 0): ?><span class="sr-only"><?=$this->transEsc('result_checkbox_label', ['%%number%%' => $this->number]) ?></span><?php endif; ?>
</label>
Expand Down