Skip to content

Commit 9923ea3

Browse files
committed
fix(PostSharing): keep status live region in the accessibility tree
Remove the hidden attribute so aria-live can announce feedback; rely on sr-only for visual hiding.
1 parent cb3ac16 commit 9923ea3

3 files changed

Lines changed: 3 additions & 8 deletions

File tree

‎components/parts/common/post-sharing.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ class="post-sharing"
3737
<span class="post-sharing__label"><?php echo esc_html__( 'Share', 'beapi-frontend-framework' ); ?></span>
3838
</button>
3939
</div>
40-
<p class="post-sharing__status" role="status" aria-live="polite" hidden></p>
40+
<p class="post-sharing__status sr-only" role="status" aria-live="polite"></p>
4141
</div>

‎src/js/classes/PostSharing.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ PostSharing.defaults = {
6060
* @param {number} delay Duration before clearing (ms).
6161
*/
6262
function showTemporaryMessage(el, message, delay) {
63+
// Keep the live region in the accessibility tree (no `hidden`):
64+
// `sr-only` already hides it visually; toggling `hidden` would block announcements.
6365
el.textContent = message
64-
el.hidden = false
6566

6667
window.setTimeout(() => {
6768
el.textContent = ''
68-
el.hidden = true
6969
}, delay)
7070
}
7171

‎src/scss/05-components/_post-sharing.scss‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use "../01-abstract/theme-json" as *;
22
@use "../02-tools/m-breakpoint" as *;
33
@use "../02-tools/m-hover" as *;
4-
@use "../02-tools/m-sr-only" as *;
54

65
/**
76
* Post sharing — copy link (desktop) / native share (mobile).
@@ -81,10 +80,6 @@
8180
}
8281
}
8382

84-
&__status {
85-
@include sr-only;
86-
}
87-
8883
// Fallback when Web Share API is unavailable: show copy on small screens.
8984
&--no-native-share {
9085
#{$el}__button--share {

0 commit comments

Comments
 (0)