File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,6 +200,12 @@ <h2>Localised Dates</h2>
200200 </ relative-time >
201201 </ p >
202202
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 >
203209 <!-- <script type="module" src="../dist/index.js"></script> -->
204210 < script type ="module " src ="https://unpkg.com/@github/relative-time-element@latest/dist/bundle.js "> </ script >
205211 < script >
Original file line number Diff line number Diff line change @@ -459,10 +459,14 @@ export class RelativeTimeElement extends HTMLElement implements Intl.DateTimeFor
459459 }
460460
461461 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+ }
463467 } else if ( this . shadowRoot === this . #renderRoot && this . textContent ) {
464468 // Ensure invalid dates fall back to lightDOM text content
465- this . #renderRoot. textContent = this . textContent
469+ this . #renderRoot. textContent = this . textContent ;
466470 }
467471
468472 if ( newText !== oldText || newTitle !== oldTitle ) {
You can’t perform that action at this time.
0 commit comments