Skip to content

Commit f11b912

Browse files
Merge pull request #401 from JLG-WOCFR-DEV/codex/review-code-and-accessibility-compliance-wnno9q
Add visible active badges for dashboard navigation
2 parents 4cd142c + cfcd6fe commit f11b912

File tree

3 files changed

+81
-3
lines changed

3 files changed

+81
-3
lines changed

docs/review-ergonomie.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
- Ajouter des marqueurs textuels (ex. « Actif ») ou icônes contrastées dans les onglets/cartes, et vérifier systématiquement le contraste (≥4.5:1) en clair et en sombre.
4141
- Lors de l’ouverture de la modale, appliquer `aria-hidden="true"` (ou `inert`) sur le conteneur principal et restaurer l’attribut à la fermeture pour empêcher la navigation au lecteur d’écran. Envisager un backdrop `<div role="presentation">` pour annoncer la prise de focus.
4242

43+
> ✅ Les onglets principaux et les cartes de filtres affichent désormais un badge « Actif » assorti d’une annonce dédiée (`screen-reader-text`), ce qui garantit une distinction perceptible sans dépendre uniquement des couleurs.
44+
4345
## Fiabilité
4446
**Constat :**
4547
- En cas d’échec de planification (`wp_schedule_single_event`), le statut est mis à jour mais l’utilisateur n’a pas de guidage pour résoudre (ex : vérifier DISABLE_WP_CRON, trigger manuel). Les solutions pro fournissent généralement un check-list contextualisé.【F:liens-morts-detector-jlg/includes/blc-admin-pages.php†L205-L274】

liens-morts-detector-jlg/assets/css/blc-admin-styles.css

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,25 @@
393393
box-shadow var(--blc-admin-transition);
394394
}
395395

396+
.blc-admin-tabs__state {
397+
display: inline-flex;
398+
align-items: center;
399+
justify-content: center;
400+
padding: 2px 8px;
401+
margin-left: 4px;
402+
font-size: 0.7rem;
403+
font-weight: 700;
404+
letter-spacing: 0.06em;
405+
text-transform: uppercase;
406+
line-height: 1;
407+
border-radius: 999px;
408+
border: 1px solid currentColor;
409+
background: var(--blc-admin-surface);
410+
color: currentColor;
411+
pointer-events: none;
412+
white-space: nowrap;
413+
}
414+
396415
.blc-admin-tabs__link:hover {
397416
color: var(--blc-admin-accent-strong);
398417
background: var(--blc-admin-accent-soft);
@@ -599,6 +618,7 @@
599618
flex-direction: column;
600619
align-items: flex-start;
601620
justify-content: center;
621+
position: relative;
602622
flex: 1 1 200px;
603623
text-align: left;
604624
gap: 10px;
@@ -618,6 +638,32 @@
618638
cursor: pointer;
619639
}
620640

641+
.blc-stat--has-status {
642+
padding-right: 70px;
643+
}
644+
645+
.blc-stat__status {
646+
position: absolute;
647+
top: 12px;
648+
right: 18px;
649+
display: inline-flex;
650+
align-items: center;
651+
justify-content: center;
652+
padding: 2px 10px;
653+
font-size: 0.7rem;
654+
font-weight: 700;
655+
letter-spacing: 0.06em;
656+
text-transform: uppercase;
657+
line-height: 1;
658+
border-radius: 999px;
659+
border: 1px solid var(--blc-admin-accent-strong);
660+
background: var(--blc-admin-surface);
661+
color: var(--blc-admin-accent-strong);
662+
pointer-events: none;
663+
box-shadow: 0 0 0 1px rgba(17, 24, 28, 0.04);
664+
white-space: nowrap;
665+
}
666+
621667
.blc-stat--static {
622668
cursor: default;
623669
}
@@ -1596,7 +1642,16 @@
15961642
.blc-stat {
15971643
width: 100%;
15981644
flex: 1 1 100%;
1599-
padding: 12px 0;
1645+
padding: 16px 18px;
1646+
}
1647+
1648+
.blc-stat--has-status {
1649+
padding-right: 76px;
1650+
}
1651+
1652+
.blc-stat__status {
1653+
top: 10px;
1654+
right: 16px;
16001655
}
16011656

16021657
.blc-manual-actions__grid {

liens-morts-detector-jlg/includes/blc-admin-pages.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,8 +726,15 @@ function blc_render_dashboard_tabs($active_tab) {
726726
esc_url($tab_url),
727727
$aria_current
728728
);
729+
$active_badge = '';
730+
$active_sr_hint = '';
729731

730-
echo '<li class="blc-admin-tabs__item"><a' . $link_attributes . '>' . esc_html($tab['label']) . '</a></li>';
732+
if ($is_active) {
733+
$active_badge = '<span class="blc-admin-tabs__state" aria-hidden="true">' . esc_html__('Actif', 'liens-morts-detector-jlg') . '</span>';
734+
$active_sr_hint = '<span class="screen-reader-text">' . esc_html__('(onglet actif)', 'liens-morts-detector-jlg') . '</span>';
735+
}
736+
737+
echo '<li class="blc-admin-tabs__item"><a' . $link_attributes . '>' . esc_html($tab['label']) . $active_sr_hint . $active_badge . '</a></li>';
731738
}
732739

733740
echo '</ul></nav>';
@@ -3262,8 +3269,20 @@ class="blc-dashboard-summary__item blc-dashboard-summary__item--<?php echo esc_a
32623269
$card_classes = array(
32633270
'blc-stat',
32643271
'blc-stat--' . $card['slug'],
3265-
$is_active_card ? 'is-active' : '',
32663272
);
3273+
3274+
if ($is_active_card) {
3275+
$card_classes[] = 'is-active';
3276+
$card_classes[] = 'blc-stat--has-status';
3277+
$aria_label .= ' ' . __('(filtre actif)', 'liens-morts-detector-jlg');
3278+
}
3279+
3280+
$active_badge = $is_active_card
3281+
? '<span class="blc-stat__status" aria-hidden="true">' . esc_html__('Actif', 'liens-morts-detector-jlg') . '</span>'
3282+
: '';
3283+
$active_sr_hint = $is_active_card
3284+
? '<span class="screen-reader-text">' . esc_html__('(filtre actif)', 'liens-morts-detector-jlg') . '</span>'
3285+
: '';
32673286
?>
32683287
<a
32693288
class="<?php echo esc_attr(implode(' ', array_filter(array_map('sanitize_html_class', $card_classes)))); ?>"
@@ -3272,11 +3291,13 @@ class="<?php echo esc_attr(implode(' ', array_filter(array_map('sanitize_html_cl
32723291
aria-label="<?php echo esc_attr($aria_label); ?>"
32733292
<?php echo $is_active_card ? ' aria-current="page"' : ''; ?>
32743293
>
3294+
<?php echo $active_badge; ?>
32753295
<span class="blc-stat-value"><?php echo esc_html($card['value']); ?></span>
32763296
<span class="blc-stat-label"><?php echo esc_html($card['label']); ?></span>
32773297
<?php if (!empty($card['cta_label'])) : ?>
32783298
<span class="blc-stat-cta"><?php echo esc_html($card['cta_label']); ?></span>
32793299
<?php endif; ?>
3300+
<?php echo $active_sr_hint; ?>
32803301
</a>
32813302
<?php endforeach; ?>
32823303
</div>

0 commit comments

Comments
 (0)