Skip to content

Commit

Permalink
v0.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jgerigmeyer committed Nov 28, 2023
1 parent c32962e commit 03153a2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Popover Attribute Polyfill Changelog

## 0.3.3: 2023-11-28

- 🐛 BUGFIX: Check slotted content for autofocus delegate --
[#150](https://github.com/oddbird/popover-polyfill/pull/150)
- 🏠 INTERNAL: Upgrade dependencies

## 0.3.2: 2023-11-13

- 🚀 NEW: Update TypeScript definitions to be compatible with v5 --
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oddbird/popover-polyfill",
"version": "0.3.2",
"version": "0.3.3",
"description": "Popover Attribute Polyfill",
"license": "BSD-3-Clause",
"publishConfig": {
Expand Down
7 changes: 5 additions & 2 deletions src/popover-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ function isFocusable(focusTarget: HTMLElement) {
return focusTarget.tabIndex !== -1;
}

// https://html.spec.whatwg.org/#focus-delegate
// This method is not spec compliant, as it also looks in slotted content
// for autofocus elements.
// See: https://github.com/oddbird/popover-polyfill/issues/149
// Spec: https://html.spec.whatwg.org/#focus-delegate
function focusDelegate(focusTarget: HTMLElement) {
if (
focusTarget.shadowRoot &&
Expand Down Expand Up @@ -221,7 +224,7 @@ function focusDelegate(focusTarget: HTMLElement) {
);
let descendant: Node | null = walker.currentNode;
while (descendant) {
// TODO: this is not spec compliant
// this is not spec compliant
if (isFocusable(descendant as HTMLElement)) {
return descendant;
}
Expand Down

0 comments on commit 03153a2

Please sign in to comment.