Skip to content

Commit

Permalink
Fix: Links missing labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Niclas Norin committed Sep 18, 2023
1 parent 246a9ce commit 08c67da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion source/php/Component/Segment/Segment.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public function init()

// If no link and exactly one button, use that button as link
if (!$link && ($buttons && count($buttons) === 1)) {
$this->data['link'] = $buttons[0]['href'];
$this->data['link']['url'] = $buttons[0]['href'];
$this->data['link']['ariaLabel'] = $buttons[0]['text'];
}

if (!empty($hasPlaceholderImage)) {
Expand Down
2 changes: 1 addition & 1 deletion source/php/Component/Segment/components/content.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'autopromote' => true
])
@link([
'href' => $link,
'href' => $link['url'],
'keepContent' => true,
'keepWrapper' => false
])
Expand Down
7 changes: 5 additions & 2 deletions source/php/Component/Segment/components/image.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
@link([
'href' => $link,
'href' => $link['url'],
'classList' => ['c-segment__image'],
'keepContent' => true,
'keepWrapper' => false
'keepWrapper' => false,
'attributeList' => [
'aria-label' => $link['ariaLabel'],
]
])
<div class="{{ $baseClass }}__image {{ $imageClass }}" style="{{ $imageStyleString }}"></div>
@endlink

0 comments on commit 08c67da

Please sign in to comment.