8000 Update readme · github/relative-time-element@fe78512 · GitHub
[go: up one dir, main page]

Skip to content

Commit fe78512

Browse files
committed
Update readme
1 parent ce767cc commit fe78512

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ So, a relative date phrase is used for up to a month and then the actual date is
8080
| `month` | `month` | `'numeric'\|'2-digit'\|'short'\|'long'\|'narrow'\|undefined` | <sup>***</sup> |
8181
| `year` | `year` | `'numeric'\|'2-digit'\|undefined` | <sup>****</sup> |
8282
| `timeZoneName` | `time-zone-name` | `'long'\|'short'\|'shortOffset'\|'longOffset'` `\|'shortGeneric'\|'longGeneric'\|undefined` | `undefined` |
83+
| `hideTitle` | `hide-title` | `boolean \| null` | - |
8384

8485
<sup>*</sup>: If unspecified, `formatStyle` will return `'narrow'` if `format` is `'elapsed'` or `'micro'`, `'short'` if the format is `'relative'` or `'datetime'`, otherwise it will be `'long'`.
8586

@@ -268,6 +269,10 @@ For dates outside of the specified `threshold`, the formatting of the date can b
268269

269270
Lang is a [built-in global attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang). Relative Time will use this to provide an applicable language to the `Intl` APIs. If the individual element does not have a `lang` attribute then it will traverse upwards in the tree to find the closest element that does, or default the lang to `en`.
270271

272+
##### hideTitle (`boolean`, default: `undefined`)
273+
274+
Passing in `hide-title="true"` will remove the `title` attribute from the `<relative-time>` element. The `title` attribute is inaccessible to screen reader and keyboard users, so hiding the title allows a user to create a custom accessible version of a tooltip if one is desired.
275+
271276
## Browser Support
272277

273278
Browsers without native [custom element support][support] require a [polyfill][ce-polyfill].

examples/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ <h2>Localised Dates</h2>
192192
</relative-time>
193193
</p>
194194

195-
<script type="module" src="../dist/index.js"></script>
196-
<!-- <script type="module" src="https://unpkg.com/@github/relative-time-element@latest/dist/bundle.js"></script> -->
195+
<!-- <script type="module" src="../dist/index.js"></script> -->
196+
<script type="module" src="https://unpkg.com/@github/relative-time-element@latest/dist/bundle.js"></script>
197197
<script>
198198
document.body.addEventListener('relative-time-updated', event => {
199199
console.log('event from', event.target, event)

0 commit comments

Comments
 (0)
0