focus-trap
Advanced tools
Comparing version 6.9.4 to 7.0.0
# Changelog | ||
## 7.0.0 | ||
### Major Changes | ||
- 5b64423: Revised and clarified official browser support (still as broad and deep as _reasonably_ possible). | ||
- 47f62ac: 🚨 **Breaking:** Tabbable dependency has been updated to v6.0.0 and contains a breaking change related to detached nodes with its default `displayCheck` setting. See tabbable's [changelog](https://github.com/focus-trap/tabbable/blob/master/CHANGELOG.md#600) for more information. | ||
- 5b64423: 🚨 **Breaking:** Dropped support of IE browsers, all versions. | ||
- IE11 was [officially retired](https://blogs.windows.com/windowsexperience/2022/06/15/internet-explorer-11-has-retired-and-is-officially-out-of-support-what-you-need-to-know/) on June 15, 2022 (6 weeks ago). There are no longer any versions of IE that are still maintained or even supported by Microsoft. | ||
## 6.9.4 | ||
@@ -4,0 +13,0 @@ |
/*! | ||
* focus-trap 6.9.4 | ||
* focus-trap 7.0.0 | ||
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE | ||
@@ -4,0 +4,0 @@ */ |
/*! | ||
* focus-trap 6.9.4 | ||
* focus-trap 7.0.0 | ||
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE | ||
@@ -4,0 +4,0 @@ */ |
/*! | ||
* focus-trap 6.9.4 | ||
* focus-trap 7.0.0 | ||
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE | ||
@@ -4,0 +4,0 @@ */ |
/*! | ||
* focus-trap 6.9.4 | ||
* focus-trap 7.0.0 | ||
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE | ||
@@ -4,0 +4,0 @@ */ |
/*! | ||
* focus-trap 6.9.4 | ||
* focus-trap 7.0.0 | ||
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE | ||
@@ -4,0 +4,0 @@ */ |
/*! | ||
* focus-trap 6.9.4 | ||
* focus-trap 7.0.0 | ||
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE | ||
@@ -4,0 +4,0 @@ */ |
{ | ||
"name": "focus-trap", | ||
"version": "6.9.4", | ||
"version": "7.0.0", | ||
"description": "Trap focus within a DOM node.", | ||
@@ -36,6 +36,6 @@ "main": "dist/focus-trap.js", | ||
"test:unit": "echo \"No unit tests to run!\"", | ||
"test:cypress": "CYPRESS_BROWSER=ANY start-server-and-test start:cypress 9966 'cypress open'", | ||
"test:cypress:ci": "start-server-and-test start:cypress 9966 'cypress run --browser $CYPRESS_BROWSER --headless'", | ||
"test:chrome": "CYPRESS_BROWSER=chrome yarn test:cypress:ci", | ||
"test": "yarn format:check && yarn lint && yarn test:unit && yarn test:types && CYPRESS_BROWSER=chrome yarn test:cypress:ci", | ||
"test:e2e": "ELECTRON_ENABLE_LOGGING=1 start-server-and-test start:cypress 9966 'cypress run --browser $CYPRESS_BROWSER --headless'", | ||
"test:e2e:chrome": "CYPRESS_BROWSER=chrome yarn test:e2e", | ||
"test:e2e:dev": "ELECTRON_ENABLE_LOGGING=1 start-server-and-test start:cypress 9966 'cypress open --browser --e2e'", | ||
"test": "yarn format:check && yarn lint && yarn test:unit && yarn test:types && yarn test:e2e:chrome", | ||
"prepare": "yarn build", | ||
@@ -67,12 +67,12 @@ "prepublishOnly": "yarn test && yarn build", | ||
"dependencies": { | ||
"tabbable": "^5.3.3" | ||
"tabbable": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.17.10", | ||
"@babel/core": "^7.18.2", | ||
"@babel/eslint-parser": "^7.18.2", | ||
"@babel/preset-env": "^7.18.2", | ||
"@changesets/cli": "^2.22.0", | ||
"@babel/cli": "^7.18.10", | ||
"@babel/core": "^7.18.10", | ||
"@babel/eslint-parser": "^7.18.9", | ||
"@babel/preset-env": "^7.18.10", | ||
"@changesets/cli": "^2.24.3", | ||
"@rollup/plugin-babel": "^5.3.1", | ||
"@rollup/plugin-commonjs": "^22.0.0", | ||
"@rollup/plugin-commonjs": "^22.0.2", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
@@ -84,19 +84,19 @@ "@testing-library/cypress": "^8.0.3", | ||
"cross-env": "^7.0.3", | ||
"cypress": "^9.7.0", | ||
"cypress": "^10.6.0", | ||
"cypress-plugin-tab": "^1.0.5", | ||
"eslint": "^8.17.0", | ||
"eslint": "^8.22.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-cypress": "^2.12.1", | ||
"eslint-plugin-jest": "^26.5.3", | ||
"eslint-plugin-jest": "^26.8.3", | ||
"onchange": "^7.1.0", | ||
"prettier": "^2.6.2", | ||
"rollup": "^2.75.6", | ||
"prettier": "^2.7.1", | ||
"rollup": "^2.78.0", | ||
"rollup-plugin-inject-process-env": "^1.3.1", | ||
"rollup-plugin-livereload": "^2.0.5", | ||
"rollup-plugin-serve": "^1.1.0", | ||
"rollup-plugin-serve": "^2.0.1", | ||
"rollup-plugin-sourcemaps": "^0.6.3", | ||
"rollup-plugin-terser": "^7.0.1", | ||
"start-server-and-test": "^1.14.0", | ||
"typescript": "^4.7.3" | ||
"typescript": "^4.7.4" | ||
} | ||
} |
@@ -56,8 +56,14 @@ # focus-trap [![CI](https://github.com/focus-trap/focus-trap/workflows/CI/badge.svg?branch=master&event=push)](https://github.com/focus-trap/focus-trap/actions?query=workflow:CI+branch:master) [![license](https://badgen.now.sh/badge/license/MIT)](./LICENSE) | ||
IE9+ | ||
As old and as broad as _reasonably_ possible, excluding browsers that are out of support or have nearly no user base. | ||
Why? | ||
Because this module uses [`EventTarget.addEventListener()`](document.createElement('button')). | ||
And its only dependency, tabbable, uses [a couple of IE9+ functions](https://github.com/focus-trap/tabbable#browser-support). | ||
Focused on desktop browsers, particularly Chrome, Edge, FireFox, Safari, and Opera. | ||
Focus-trap is not officially tested on any mobile browsers or devices. | ||
> ⚠️ Microsoft [no longer supports](https://blogs.windows.com/windowsexperience/2022/06/15/internet-explorer-11-has-retired-and-is-officially-out-of-support-what-you-need-to-know/) any version of IE, so IE is no longer supported by this library. | ||
> 💬 Focus-trap relies on tabbable so its browser support is at least [what tabbable supports](https://github.com/focus-trap/tabbable#browser-support). | ||
> 💬 Keep in mind that performance optimization and old browser support are often at odds, so tabbable may not always be able to use the most optimal (typically modern) APIs in all cases. | ||
## Usage | ||
@@ -89,6 +95,6 @@ | ||
- **onPostActivate** `{() => void}`: A function that will be called **after** sending focus to the target element upon activation. | ||
- **checkCanFocusTrap** `{(containers: Array<HTMLElement | SVGElement>) => Promise<void>}`: Animated dialogs have a small delay between when `onActivate` is called and when the focus trap is focusable. `checkCanFocusTrap` expects a promise to be returned. When that promise settles (resolves or rejects), focus will be sent to the first tabbable node (in tab order) in the focus trap (or the node configured in the `initialFocus` option). Due to the lack of Promise support, `checkCanFocusTrap` is not supported in IE unless you provide a Promise polyfill. | ||
- **checkCanFocusTrap** `{(containers: Array<HTMLElement | SVGElement>) => Promise<void>}`: Animated dialogs have a small delay between when `onActivate` is called and when the focus trap is focusable. `checkCanFocusTrap` expects a promise to be returned. When that promise settles (resolves or rejects), focus will be sent to the first tabbable node (in tab order) in the focus trap (or the node configured in the `initialFocus` option). | ||
- **onDeactivate** `{() => void}`: A function that will be called **before** returning focus to the node that had focus prior to activation (or configured with the `setReturnFocus` option) upon deactivation. | ||
- **onPostDeactivate** `{() => void}`: A function that will be called after the trap is deactivated, after `onDeactivate`. If the `returnFocus` deactivation option was set, it will be called **after** returning focus to the node that had focus prior to activation (or configured with the `setReturnFocus` option) upon deactivation; otherwise, it will be called after deactivation completes. | ||
- **checkCanReturnFocus** `{(trigger: HTMLElement | SVGElement) => Promise<void>}`: An animated trigger button will have a small delay between when `onDeactivate` is called and when the focus is able to be sent back to the trigger. `checkCanReturnFocus` expects a promise to be returned. When that promise settles (resolves or rejects), focus will be sent to to the node that had focus prior to the activation of the trap (or the node configured in the `setReturnFocus` option). Due to the lack of Promise support, `checkCanReturnFocus` is not supported in IE unless you provide a Promise polyfill. | ||
- **checkCanReturnFocus** `{(trigger: HTMLElement | SVGElement) => Promise<void>}`: An animated trigger button will have a small delay between when `onDeactivate` is called and when the focus is able to be sent back to the trigger. `checkCanReturnFocus` expects a promise to be returned. When that promise settles (resolves or rejects), focus will be sent to to the node that had focus prior to the activation of the trap (or the node configured in the `setReturnFocus` option). | ||
- **initialFocus** `{HTMLElement | SVGElement | string | false | (() => HTMLElement | SVGElement | string | false)}`: By default, when a focus trap is activated the first element in the focus trap's tab order will receive focus. With this option you can specify a different element to receive that initial focus. Can be a DOM node, or a selector string (which will be passed to `document.querySelector()` to find the DOM node), or a function that returns any of these. You can also set this option to `false` (or to a function that returns `false`) to prevent any initial focus at all when the trap activates. | ||
@@ -95,0 +101,0 @@ - 💬 Setting this option to `false` (or a function that returns `false`) will prevent the `fallbackFocus` option from being used. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
449773
352
+ Addedtabbable@6.2.0(transitive)
- Removedtabbable@5.3.3(transitive)
Updatedtabbable@^6.0.0