@github/arianotify-polyfill

中文文档
2.4.0发布于 2026/04/23MITES Module零依赖构建来源已验证近 30 天下载 10.3万

Polyfill for the ARIA Notification API

原始使用文档
文档目录6 节
  1. Background
  2. Requirements
  3. License
  4. Maintainers
  5. Support
  6. Acknowledgement

arianotify-polyfill

Polyfill for the ARIA Notification API

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 and/or Document.prototype.ariaNotify functions if they do not exist, emulating the native functionality.

This is used in production on github.com.

Background

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, achieving a similar effect to the native functionality.

Requirements

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.

$ npm i @github/arianotify-polyfill

In your JavaScript you can introduce the polyfill using a "bare" import:

import "@github/arianotify-polyfill"

Then continue to use ariaNotify as if it were supported everywhere. A small contrived example:

button.ariaNotify("Saved")

License

This project is licensed under the terms of the MIT open source license. Please refer to MIT for the full terms.

Maintainers

The @github/accessibility and @github/primer teams maintain this library.

Support

This library is provided "as is". Please feel free to file issues; however, we offer no time frame for correspondence or resolution of any issues.

Acknowledgement

Special thanks to Microsoft and the ARIA Working Group for making ariaNotify a possibility.

版本与发布记录

@github/arianotify-polyfill 共发布 13 个版本,首次发布于 2024/08/14;过去 12 个月发布了 5 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.4.0latest2026/04/236 个月前
2.3.32026/04/117 个月前
2.3.22026/04/097 个月前
2.3.02026/01/1510 个月前
2.2.32026/01/1510 个月前
2.2.12025/07/311.3 年前

关于 @github/arianotify-polyfill 的常见问题

@github/arianotify-polyfill 是什么?

Polyfill for the ARIA Notification API

如何安装 @github/arianotify-polyfill?

在项目目录运行 npm install @github/arianotify-polyfill,或使用 pnpm add / yarn add / bun add。

@github/arianotify-polyfill 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/github__arianotify-polyfill 是否存在。

@github/arianotify-polyfill 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@github/arianotify-polyfill 可以商用吗?

@github/arianotify-polyfill 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@github/arianotify-polyfill 的下载量有多少?

根据 npm 官方下载统计,@github/arianotify-polyfill 在 2026/10/17 – 2026/11/15 这 30 天内被下载 103,255 次,日均约 3,442 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@github/arianotify-polyfill 还在维护吗?

最新版本 2.4.0 发布于 2026/04/23(6 个月前);至今共发布 13 个版本,其中过去 12 个月发布了 5 个;首次发布于 2024/08/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。