File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,12 @@ <h2>Localised Dates</h2>
200
200
</ relative-time >
201
201
</ p >
202
202
203
+ < p >
204
+ With aria-hidden
205
+ < relative-time aria-hidden ="true " datetime ="1970-01-01T00:00:00.000Z " format ="datetime ">
206
+ Jan 1 1970
207
+ </ relative-time >
208
+ </ p >
203
209
<!-- <script type="module" src="../dist/index.js"></script> -->
204
210
< script type ="module " src ="https://unpkg.com/@github/relative-time-element@latest/dist/bundle.js "> </ script >
205
211
< script >
Original file line number Diff line number Diff line change @@ -459,10 +459,14 @@ export class RelativeTimeElement extends HTMLElement implements Intl.DateTimeFor
459
459
}
460
460
461
461
if ( newText ) {
462
- this . #renderRoot. textContent = newText
462
+ if ( this . hasAttribute ( 'aria-hidden' ) && this . getAttribute ( 'aria-hidden' ) === 'true' ) {
463
+ ( this . #renderRoot as Element ) . innerHTML = `<span aria-hidden="true">${ newText } </span>` ;
464
+ } else {
465
+ this . #renderRoot. textContent = newText ;
466
+ }
463
467
} else if ( this . shadowRoot === this . #renderRoot && this . textContent ) {
464
468
// Ensure invalid dates fall back to lightDOM text content
465
- this . #renderRoot. textContent = this . textContent
469
+ this . #renderRoot. textContent = this . textContent ;
466
470
}
467
471
468
472
if ( newText !== oldText || newTitle !== oldTitle ) {
You can’t perform that action at this time.
0 commit comments