Skip to content

Commit 6c4e10d

Browse files
committed
Add alt text in image
1 parent 9455425 commit 6c4e10d

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

assets/js/focus-element.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
/* global progressPlannerFocusElement */
22

3-
const prplGetIndicatorElement = ( content, taskId ) => {
3+
const prplGetIndicatorElement = ( content, taskId, points ) => {
44
// Create an <img> element.
55
const imgEl = document.createElement( 'img' );
66
imgEl.src =
77
progressPlannerFocusElement.base_url +
88
'/assets/images/icon_progress_planner.svg';
9-
imgEl.alt = '';
9+
imgEl.alt = points
10+
? progressPlannerFocusElement.l10n.fixThisIssue.replace( '%d', points )
11+
: '';
1012

1113
// Create a span element for the points.
1214
const spanEl = document.createElement( 'span' );
@@ -59,15 +61,18 @@ const prplAddPointsIndicatorToElement = ( task ) => {
5961
document.querySelectorAll( task.link_setting.iconEl ).forEach( ( el ) => {
6062
const iconEl = prplGetIndicatorElement(
6163
task.is_complete ? '✓' : '+' + points,
62-
task.task_id
64+
task.task_id,
65+
points
6366
);
6467
if ( task.is_complete ) {
6568
iconEl.classList.add( 'complete' );
6669
}
6770

6871
// Create a positioning wrapper.
6972
const wrapperEl = document.createElement( 'span' );
70-
wrapperEl.classList.add( 'prpl-element-awards-points-icon-positioning-wrapper' );
73+
wrapperEl.classList.add(
74+
'prpl-element-awards-points-icon-positioning-wrapper'
75+
);
7176

7277
// Add the icon to the wrapper.
7378
wrapperEl.appendChild( iconEl );

classes/admin/class-page.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ public function maybe_enqueue_focus_el_script( $hook ) {
196196
'totalPoints' => $total_points,
197197
'completedPoints' => $completed_points,
198198
'base_url' => PROGRESS_PLANNER_URL,
199+
'l10n' => [
200+
/* translators: %d: The number of points. */
201+
'fixThisIssue' => \esc_html__( 'Fix this issue to get %d point(s) in Progress Planner', 'progress-planner' ),
202+
],
199203
]
200204
);
201205
\wp_enqueue_style(

0 commit comments

Comments
 (0)