Skip to content

Commit de523b6

Browse files
authored
Merge pull request #563 from devgeniem/TMS-1260
TMS-1260: Add missing alt-text for enlargened images in image-block
2 parents 5bd3bfb + ed5af74 commit de523b6

File tree

7 files changed

+169
-70
lines changed

7 files changed

+169
-70
lines changed

CHANGELOG.MD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
- TMS-1260: Add missing alt-text for enlargened images in image-block
1011
- TMS-1261: Change highlighted articles pill colors
1112
- TMS-1264: Fix Eventz to use endpoint url from env
1213
- TMS-1263: Fix pagination from showing arrow button on last page

assets/scripts/image.js

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ const $ = jQuery; // eslint-disable-line no-unused-vars
1212
* Export the class reference.
1313
*/
1414
export default class Image {
15+
/**
16+
* Store the element that triggered the modal.
17+
*/
18+
constructor() {
19+
this.lastModalTrigger = null;
20+
}
21+
1522
/**
1623
* Run when the document is ready.
1724
*
@@ -21,7 +28,13 @@ export default class Image {
2128
$( '.has-modal' ).modaal( {
2229
type: 'image',
2330
background_scroll: false,
24-
after_open: this.disableBackgroundItemFocusing,
31+
before_open: () => {
32+
this.lastModalTrigger = document.activeElement;
33+
},
34+
after_open: () => {
35+
this.disableBackgroundItemFocusing();
36+
this.setModalImageAltText();
37+
},
2538
accessible_title: window.s.modaal.accessible_title || 'Enlarged image',
2639
close_aria_label: window.s.modaal.close || 'Close',
2740
} );
@@ -67,4 +80,39 @@ export default class Image {
6780
);
6881
}
6982
}
83+
84+
/**
85+
* Set alt text for the modal image using the trigger element's data.
86+
*/
87+
setModalImageAltText() {
88+
const modalImage = document.querySelector( '.modaal-container img' );
89+
90+
if ( ! modalImage ) {
91+
return;
92+
}
93+
94+
const trigger = this.lastModalTrigger;
95+
let sourceImage = null;
96+
97+
if ( ! trigger ) {
98+
return;
99+
}
100+
101+
if ( trigger.tagName === 'IMG' ) {
102+
sourceImage = trigger;
103+
}
104+
else if ( trigger.tagName === 'A' ) {
105+
sourceImage = trigger.querySelector( 'img' );
106+
}
107+
108+
if ( ! sourceImage ) {
109+
return;
110+
}
111+
112+
const altText = sourceImage.getAttribute( 'alt' );
113+
114+
if ( altText ) {
115+
modalImage.setAttribute( 'alt', altText );
116+
}
117+
}
70118
}

lang/fi.mo

72 Bytes
Binary file not shown.

lang/fi.po

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
msgid ""
22
msgstr ""
33
"Project-Id-Version: TMS Theme Base\n"
4-
"POT-Creation-Date: 2025-10-29 12:00+0200\n"
5-
"PO-Revision-Date: 2025-10-29 12:00+0200\n"
4+
"POT-Creation-Date: 2026-03-26 12:18+0200\n"
5+
"PO-Revision-Date: 2026-03-26 12:19+0200\n"
66
"Last-Translator: \n"
77
"Language-Team: \n"
88
"Language: fi\n"
@@ -22,9 +22,28 @@ msgstr ""
2222
"X-Poedit-SearchPathExcluded-1: vendor\n"
2323
"X-Poedit-SearchPathExcluded-2: node_modules\n"
2424

25-
#: assets/dist/vendor.js:4630
26-
msgctxt "text direction"
27-
msgid "ltr"
25+
#: assets/dist/vendor.js:1
26+
msgid "entries"
27+
msgstr ""
28+
29+
#: assets/dist/vendor.js:1
30+
msgid "values"
31+
msgstr ""
32+
33+
#: assets/dist/vendor.js:1
34+
msgid "keys"
35+
msgstr ""
36+
37+
#: assets/dist/vendor.js:1
38+
msgid "Wrong index!"
39+
msgstr ""
40+
41+
#: assets/dist/vendor.js:1
42+
msgid "Wrong offset!"
43+
msgstr ""
44+
45+
#: assets/dist/vendor.js:1
46+
msgid "Wrong length!"
2847
msgstr ""
2948

3049
#: comments.php:14
@@ -113,122 +132,127 @@ msgstr "Tekstikappale"
113132
msgid "Header"
114133
msgstr "Ylätunniste"
115134

116-
#: lib/Assets.php:400
135+
#: lib/Assets.php:408
117136
msgid "Audio guide"
118137
msgstr "Ääni-opastus"
119138

120-
#: lib/Assets.php:401
139+
#: lib/Assets.php:409
121140
msgid "Assistant"
122141
msgstr "Avustaja"
123142

124-
#: lib/Assets.php:402
143+
#: lib/Assets.php:410
125144
msgid "Lift"
126145
msgstr "Hissi"
127146

128-
#: lib/Assets.php:403
147+
#: lib/Assets.php:411
129148
msgid "Induction loop"
130149
msgstr "Induktio-silmukka"
131150

132-
#: lib/Assets.php:404
151+
#: lib/Assets.php:412
133152
msgid "Information"
134153
msgstr "Info"
135154

136-
#: lib/Assets.php:405
155+
#: lib/Assets.php:413
137156
msgid "Internet"
138157
msgstr "Internet"
139158

140-
#: lib/Assets.php:406
159+
#: lib/Assets.php:414
141160
msgid "Accessible entrance, Accessible toilet, Accessible parking"
142161
msgstr "Esteetön sisäänkäynti, esteetön WC, esteetön pysäköinti"
143162

144-
#: lib/Assets.php:407
163+
#: lib/Assets.php:415
145164
msgid "Café"
146165
msgstr "Kahvila"
147166

148-
#: lib/Assets.php:408
167+
#: lib/Assets.php:416
149168
msgid "Shop"
150169
msgstr "Myymälä"
151170

152-
#: lib/Assets.php:409
171+
#: lib/Assets.php:417
153172
msgid "Meeting room"
154173
msgstr "Kokoustila"
155174

156-
#: lib/Assets.php:410
175+
#: lib/Assets.php:418
157176
msgid "Assistive device lending"
158177
msgstr "Lainattavia apuvälineitä"
159178

160-
#: lib/Assets.php:411
179+
#: lib/Assets.php:419
161180
msgid "Baby changing"
162181
msgstr "Lastenhoito-tila"
163182

164-
#: lib/Assets.php:412
183+
#: lib/Assets.php:420
165184
msgid "Charging point"
166185
msgstr "Latauspiste"
167186

168-
#: lib/Assets.php:413
187+
#: lib/Assets.php:421
169188
msgid "Ticket sales"
170189
msgstr "Lipunmyyti"
171190

172-
#: lib/Assets.php:414
191+
#: lib/Assets.php:422
173192
msgid "Ramp"
174193
msgstr "Luiska"
175194

176-
#: lib/Assets.php:415
195+
#: lib/Assets.php:423
177196
msgid "Services for the visually impaired"
178197
msgstr "Näkö-vammaisia helpottavia palveluja"
179198

180-
#: lib/Assets.php:416
199+
#: lib/Assets.php:424
181200
msgid "Service dogs allowed"
182201
msgstr "Opaskoira sallittu"
183202

184-
#: lib/Assets.php:417
203+
#: lib/Assets.php:425
185204
msgid "Braille"
186205
msgstr "Piste-kirjoitus"
187206

188-
#: lib/Assets.php:418
207+
#: lib/Assets.php:426
189208
msgid "Stairlift"
190209
msgstr "Porrashissi"
191210

192-
#: lib/Assets.php:419
211+
#: lib/Assets.php:427
193212
msgid "Staircase"
194213
msgstr "Portaat"
195214

196-
#: lib/Assets.php:420
215+
#: lib/Assets.php:428
197216
msgid "Platform lift"
198217
msgstr "Pyöratuoli-hissi, nostotaso"
199218

200-
#: lib/Assets.php:421
219+
#: lib/Assets.php:429
201220
msgid "Rollator, walker"
202221
msgstr "Rollaattori"
203222

204-
#: lib/Assets.php:422
223+
#: lib/Assets.php:430
205224
msgid "Electric mobility scooter storage"
206225
msgstr "Sähkömopo-säilytys"
207226

208-
#: lib/Assets.php:423
227+
#: lib/Assets.php:431
209228
msgid "Lockers"
210229
msgstr "Säilytys-lokero"
211230

212-
#: lib/Assets.php:424
231+
#: lib/Assets.php:432
213232
msgid "Large print"
214233
msgstr "Suuri teksti"
215234

216-
#: lib/Assets.php:425
235+
#: lib/Assets.php:433
217236
msgid "Cloakroom"
218237
msgstr "Vaate-säilytys"
219238

220-
#: lib/Assets.php:426
239+
#: lib/Assets.php:434
221240
msgid "Sign-language services"
222241
msgstr "Viittoma-kielinen palvelu"
223242

224-
#: lib/Assets.php:427 lib/Assets.php:428
243+
#: lib/Assets.php:435 lib/Assets.php:436
225244
msgid "Accessible toilet: one-sided access"
226245
msgstr "Esteetön wc, yksipuolisesti käytettävä"
227246

228-
#: lib/Assets.php:429
247+
#: lib/Assets.php:437
229248
msgid "WC"
230249
msgstr "WC"
231250

251+
#: lib/Blocks/ImageBlock.php:84
252+
msgctxt "theme-frontend"
253+
msgid "Open large image"
254+
msgstr "Avaa kuva suurennettuna"
255+
232256
#: lib/Comments.php:72
233257
msgid "Send Comment"
234258
msgstr "Lähetä kommentti"

0 commit comments

Comments
 (0)