Skip to content

Commit 6291a23

Browse files
authored
Update README.md
1 parent a0021f0 commit 6291a23

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,47 @@
11
# ariaNotify-polyfill
2+
23
Polyfill for the ARIA Notification API
4+
5+
The goal of this library is to polyfill `ariaNotify` so that it can be used seamlessly across browsers that support the native functionality, and those that don't. This adds the `Element.prototype.ariaNotify` function if it does not exist, emulating the native functionaltiy.
6+
7+
This is used in production on github.com.
8+
9+
## Background
10+
11+
In browsers where `ariaNotify` is supported it will emit a notification event. In browsers where it isn't supported this library will create a "fake" element that is an aria-live region, insert it into the DOM, and modify the text content of the element to place the given message in, acheiving a similar effect to the native functionality.
12+
13+
## Requirements
14+
15+
This is only meant to be used in a browser context. It should not be used on the server. To install this you will likely need `npm`.
16+
17+
```sh
18+
$ npm i @github/ariaNotify-polyfill
19+
```
20+
21+
In your JavaScript you can introduce the polyfill using a "bare" import:
22+
23+
```js
24+
import "@github/ariaNotify-polyfill"
25+
```
26+
27+
Then continue to use `ariaNotify` as if it were supported everywhere. A small contrived example:
28+
29+
```js
30+
button.ariaNotify("Saved")
31+
```
32+
33+
## License
34+
35+
This project is licensed under the terms of the MIT open source license. Please refer to [MIT](./LICENSE.txt) for the full terms.
36+
37+
## Maintainers
38+
39+
The @github/accessibiltiy and @github/primer teams maintain this library.
40+
41+
## Support
42+
43+
This library is provided "as is". Please feel free to file issues we offer no time frame for correspondance or resolution of any issues.
44+
45+
## Acknowledgement
46+
47+
Special thanks to Microsoft and the ARIA Working Group for making `ariaNotify` a possibility.

0 commit comments

Comments
 (0)