Skip to content
Snippets Groups Projects
Commit a91baad8 authored by Olivia206's avatar Olivia206
Browse files

Merge branch 'main' into front/share-links

parents 74e88046 d3588e01
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,6 @@ class Search {
}
this.input = this.element.querySelector('input');
this.listen();
}
......@@ -41,6 +40,12 @@ class Search {
}
} else if (event.key === "Tab" && this.state.isOpened) {
this.innerFocus(event);
this.buttonMore = this.element.querySelector('.pagefind-ui__results + button');
if (this.buttonMore) {
this.buttonMoreFocus();
}
}
});
}
......@@ -84,6 +89,20 @@ class Search {
}
}
buttonMoreFocus() {
const observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(addedNode => {
if (addedNode instanceof HTMLAnchorElement) {
addedNode.focus();
}
});
});
});
const observerConfig = { childList: true, subtree: true };
observer.observe(this.element, observerConfig);
}
toggle(open = !this.state.isOpened) {
this.state.isOpened = open;
this.element.setAttribute('aria-hidden', !this.state.isOpened);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment