Skip to content

Commit

Permalink
Merge pull request #12854 from craftcms/a11y/dont-use-title-for-alt
Browse files Browse the repository at this point in the history
Do not use title as fallback for alt text
  • Loading branch information
brandonkelly authored Mar 29, 2023
2 parents 2a1e16d + 612044c commit d1f82a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Content Management

### Accessibility
- Image assets’ thumbnails and `<img>` tags generated via `craft\element\Asset::getImg()` no longer use the assets’ titles as `alt` fallback values. ([#12854](https://github.com/craftcms/cms/pull/12854))

### Administration

Expand Down
2 changes: 1 addition & 1 deletion src/elements/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ public function getImg(mixed $transform = null, ?array $sizes = null): ?Markup
'width' => $this->getWidth(),
'height' => $this->getHeight(),
'srcset' => $sizes ? $this->getSrcset($sizes) : false,
'alt' => $this->alt ?? $this->title,
'alt' => $this->alt ?? false,
]);
} else {
$img = null;
Expand Down

0 comments on commit d1f82a9

Please sign in to comment.