diff --git a/packages/toast/package.json b/packages/toast/package.json index f8971403..a55359be 100644 --- a/packages/toast/package.json +++ b/packages/toast/package.json @@ -1,7 +1,7 @@ { "name": "universal-toast", "author": "rax", - "version": "1.2.0", + "version": "1.2.1", "description": "", "main": "lib/index.js", "files": [ diff --git a/packages/toast/src/web/index.ts b/packages/toast/src/web/index.ts index ef1c94f6..76b41e7b 100644 --- a/packages/toast/src/web/index.ts +++ b/packages/toast/src/web/index.ts @@ -37,6 +37,9 @@ function showToastWindow(message: string): void { if (!toastWin) { toastWin = document.createElement('div'); toastWin.setAttribute('role', 'alert'); + // support for ARIA, add tabindex for focus + // https://developer.mozilla.org/zh-CN/docs/Web/HTML/Global_attributes/tabindex + toastWin.setAttribute('tabindex', '-1'); for (let key in styles.container) { toastWin.style[key] = styles.container[key]; }