-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve accessibility of cover images
- Loading branch information
Showing
5 changed files
with
33 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 9 additions & 6 deletions
15
themes/bootstrap3/templates/RecordDriver/DefaultRecord/cover.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
<?php $alt = $this->link ? trim($this->driver->tryMethod('getTitle') ?? '') : ''; ?> | ||
<?php if ($this->link && !empty($alt)): ?><a href="<?=$this->escapeHtmlAttr($this->link)?>" class="record-cover-link"><?php endif; ?> | ||
<?php if ($this->link): ?> | ||
<a href="<?=$this->escapeHtmlAttr($this->link)?>" class="record-cover-link" <?php if (!$this->linkUnique): ?>tabindex="-1" aria-hidden="true"<?php endif; ?>> | ||
<?php else: ?> | ||
<div aria-hidden="true"> | ||
<?php endif; ?> | ||
<?php /* Display thumbnail if appropriate: */ ?> | ||
<?php if ($cover): ?> | ||
<img src="<?=$this->escapeHtmlAttr($cover); ?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="recordcover" alt="<?=$this->escapeHtmlAttr($alt); ?>"> | ||
<img src="<?=$this->escapeHtmlAttr($cover); ?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="recordcover" alt="<?=$this->transEscAttr('Cover Image') ?>"> | ||
<?php elseif ($cover === false): ?> | ||
<img src="<?=$this->url('cover-unavailable')?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="recordcover" alt=""> | ||
<img src="<?=$this->url('cover-unavailable')?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="recordcover" alt="<?=$this->transEscAttr('No Cover Image') ?>"> | ||
<?php else: ?> | ||
<div class="ajaxcover"> | ||
<div class="spinner"><?=$this->icon('spinner') ?> <?=$this->translate('loading_ellipsis')?></div> | ||
<div class="cover-container"> | ||
<img <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>data-context="<?=$this->escapeHtmlAttr($this->context)?>" data-recordsource="<?=$this->escapeHtmlAttr($driver->getSourceIdentifier())?>" data-recordid="<?=$this->escapeHtmlAttr($driver->getUniqueID())?>" data-coversize="<?=$this->escapeHtmlAttr($size)?>" class="recordcover ajax" alt="<?=$this->escapeHtmlAttr($alt); ?>"> | ||
<img <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>data-context="<?=$this->escapeHtmlAttr($this->context)?>" data-recordsource="<?=$this->escapeHtmlAttr($driver->getSourceIdentifier())?>" data-recordid="<?=$this->escapeHtmlAttr($driver->getUniqueID())?>" data-coversize="<?=$this->escapeHtmlAttr($size)?>" class="recordcover ajax" alt="<?=$this->transEscAttr('Cover Image') ?>"> | ||
</div> | ||
</div> | ||
<?php endif; ?> | ||
<?php if ($this->link && !empty($alt)): ?></a><?php endif; ?> | ||
<?php if ($this->link): ?></a><?php else: ?></div><?php endif; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
<?php | ||
// set $alt to empty when we have an icon ($cover === false), because we don't want to link the icons (it looks weird) | ||
$alt = $this->link && $cover !== false ? trim($this->driver->tryMethod('getTitle') ?? '') : ''; | ||
// we don't want to link the icons ($cover === false) (it looks weird) | ||
$includeLinkInMarkup = $this->link && $cover !== false; | ||
?> | ||
<?php if ($this->link && !empty($alt)): ?><a href="<?=$this->escapeHtmlAttr($this->link)?>" class="record-cover-link"><?php endif; ?> | ||
<?php if ($includeLinkInMarkup): ?> | ||
<a href="<?=$this->escapeHtmlAttr($this->link)?>" class="record-cover-link" <?php if (!$this->linkUnique): ?>tabindex="-1" aria-hidden="true"<?php endif; ?>> | ||
<?php else: ?> | ||
<div aria-hidden="true"> | ||
<?php endif; ?> | ||
<?php /* Display thumbnail if appropriate: */ ?> | ||
<?php if ($cover): ?> | ||
<img src="<?=$this->escapeHtmlAttr($cover); ?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="recordcover" alt="<?=$this->escapeHtmlAttr($alt); ?>"> | ||
<img src="<?=$this->escapeHtmlAttr($cover); ?>" <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>class="recordcover" alt="<?=$this->transEscAttr('Cover Image') ?>"> | ||
<?php elseif ($cover === false): ?> | ||
<span class="recordcover pt-icon pt-<?=$this->driver->getPubTypeId()?>"></span> | ||
<div><?=$this->driver->getPubType()?></div> | ||
<?php else: ?> | ||
<div class="ajaxcover"> | ||
<div class="spinner"><?=$this->icon('spinner') ?> <?=$this->translate('loading_ellipsis')?></div> | ||
<div class="cover-container"> | ||
<img <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>data-context="<?=$this->escapeHtmlAttr($this->context)?>" data-recordsource="<?=$this->escapeHtmlAttr($driver->getSourceIdentifier())?>" data-recordid="<?=$this->escapeHtmlAttr($driver->getUniqueID())?>" data-coversize="<?=$this->escapeHtmlAttr($size)?>" class="recordcover ajax" alt="<?=$this->escapeHtmlAttr($alt); ?>"> | ||
<img <?php if ($linkPreview): ?>data-linkpreview="true" <?php endif; ?>data-context="<?=$this->escapeHtmlAttr($this->context)?>" data-recordsource="<?=$this->escapeHtmlAttr($driver->getSourceIdentifier())?>" data-recordid="<?=$this->escapeHtmlAttr($driver->getUniqueID())?>" data-coversize="<?=$this->escapeHtmlAttr($size)?>" class="recordcover ajax" alt="<?=$this->transEscAttr('Cover Image') ?>"> | ||
</div> | ||
</div> | ||
<?php endif; ?> | ||
<?php if ($this->link && !empty($alt)): ?></a><?php endif; ?> | ||
<?php if ($includeLinkInMarkup): ?></a><?php else: ?></div><?php endif; ?> |