Skip to content

Commit f70ec48

Browse files
author
nod_
committed
Issue #3273099 by rkoller, jaydeep_patel, tinto, smustgrave: Fix several accessibility related issues on the edit Image style page
1 parent 9643d6f commit f70ec48

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

modules/image/css/image.admin.css

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
}
1515
.image-style-preview .preview-image {
1616
position: relative;
17-
margin: auto;
17+
margin: 0.5em auto auto auto;
18+
}
19+
.image-style-preview .preview-image a,
20+
.image-style-preview .preview-image a img {
21+
display: block;
1822
}
1923
.image-style-preview .preview-image .width {
2024
position: absolute;

modules/image/image.admin.inc

+8-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ function template_preprocess_image_style_preview(&$variables) {
8181
$variables['original']['rendered'] = [
8282
'#theme' => 'image',
8383
'#uri' => $original_path,
84-
'#alt' => t('Sample original image'),
84+
'#alt' => t('Source image: @width pixels wide, @height pixels high', [
85+
'@width' => $variables['original']['width'],
86+
'@height' => $variables['original']['height'],
87+
]),
8588
'#title' => '',
8689
'#attributes' => [
8790
'width' => $variables['original']['width'],
@@ -95,7 +98,10 @@ function template_preprocess_image_style_preview(&$variables) {
9598
$variables['derivative']['rendered'] = [
9699
'#theme' => 'image',
97100
'#uri' => $variables['derivative']['url'] . '?cache_bypass=' . $variables['cache_bypass'] . '&itok=' . $variables['itok'],
98-
'#alt' => t('Sample modified image'),
101+
'#alt' => t('Derivative image: @width pixels wide, @height pixels high', [
102+
'@width' => $variables['derivative']['width'],
103+
'@height' => $variables['derivative']['height'],
104+
]),
99105
'#title' => '',
100106
'#attributes' => [
101107
'width' => $variables['derivative']['width'],

modules/image/src/Form/ImageStyleEditForm.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function form(array $form, FormStateInterface $form_state) {
6060
$preview_arguments = ['#theme' => 'image_style_preview', '#style' => $this->entity];
6161
$form['preview'] = [
6262
'#type' => 'item',
63-
'#title' => $this->t('Preview'),
63+
'#title' => $this->t('Preview (Click for actual images)'),
6464
'#markup' => \Drupal::service('renderer')->render($preview_arguments),
6565
// Render preview above parent elements.
6666
'#weight' => -5,

modules/image/templates/image-style-preview.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<div class="image-style-preview preview clearfix">
3434
{# Preview of the original image. #}
3535
<div class="preview-image-wrapper">
36-
{{ 'original'|t }} (<a href="{{ original.url }}">{{ 'view actual size'|t }}</a>)
36+
{{ 'Source image'|t }}
3737
<div class="preview-image original-image" style="width: {{ preview.original.width }}px; height: {{ preview.original.height }}px;">
3838
<a href="{{ original.url }}">
3939
{{ original.rendered }}
@@ -45,7 +45,7 @@
4545

4646
{# Derivative of the image style. #}
4747
<div class="preview-image-wrapper">
48-
{{ style_name }} (<a href="{{ derivative.url }}?{{ cache_bypass }}">{{ 'view actual size'|t }}</a>)
48+
{{ 'Derivative image'|t }}
4949
<div class="preview-image modified-image" style="width: {{ preview.derivative.width }}px; height: {{ preview.derivative.height }}px;">
5050
<a href="{{ derivative.url }}?{{ cache_bypass }}">
5151
{{ derivative.rendered }}

0 commit comments

Comments
 (0)