https://github.com/calebdwilliams/delegates-focus-polyfill
A polyfill for the delegatesFocus option to HTMLElement.prototype.attachShadow
https://github.com/calebdwilliams/delegates-focus-polyfill
Last synced: 23 days ago
JSON representation
A polyfill for the delegatesFocus option to HTMLElement.prototype.attachShadow
- Host: GitHub
- URL: https://github.com/calebdwilliams/delegates-focus-polyfill
- Owner: calebdwilliams
- Created: 2019-11-15T21:41:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-04T20:39:13.000Z (over 2 years ago)
- Last Synced: 2024-10-29T10:08:30.190Z (6 months ago)
- Language: JavaScript
- Size: 648 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Delegates focus polyfill
This package adds support for the `delegatesFocus` flad to the `HTMLElement.attachShadowRoot` method. Setting the value to `true` will allow the shadow host to delegate its focus events and calls to the first focusable element inside the shadow DOM.
This article on MDN will illustarate how to use the feature and browser support. The syntax is as follows.
```javascript
someElement.attachShadow({
mode: 'open',
delegatesFocus: true
});
```This will also add the `delegatesFocus` property to the shadow root object with the value associated with the flag.
```javascript
someElement.shadowRoot.delegatesFocus === true; // would evaluate to true
```