Compare commits

...

1 commit

2 changed files with 16 additions and 9 deletions

View file

@ -57,10 +57,6 @@ body[vv-page]::before {
opacity: 1; opacity: 1;
} }
body.search-dialog-open {
overflow: hidden;
}
a { a {
display: contents; display: contents;
color: inherit; color: inherit;
@ -168,8 +164,10 @@ header > * {
/* enable 3d flip animation */ /* enable 3d flip animation */
@media not (prefers-reduced-motion: reduce) { @media not (prefers-reduced-motion: reduce) {
header > * { header > * {
transition: 600ms transform, 300ms background-color; --transform-duration: 600ms;
transition: var(--transform-duration) transform, 300ms background-color;
} }
} }
@ -252,12 +250,10 @@ header searchbox input {
header.searchboxActive > * { header.searchboxActive > * {
transform: rotateX(-180deg); transform: rotateX(-180deg);
pointer-events: none;
} }
header.searchboxActive searchbox { header.searchboxActive searchbox {
transform: rotateX(0); transform: rotateX(0);
pointer-events: all;
} }
/* ## Main */ /* ## Main */

View file

@ -1,6 +1,17 @@
new vv.Interactions("document", { new vv.Interactions("document", {
navigateHome: () => new vv.Navigation("/").navigate(), navigateHome: () => new vv.Navigation("/").navigate(),
closeSearchbox: () => document.querySelector("header").classList.remove("searchboxActive"), closeSearchbox: () => {
// Disable search button interaction while animation is running
// This is required to prevent conflicts with the :hover "peak" transformation
const searchButtonElement = document.querySelector("header button.search");
const transformDuration = parseInt(window.getComputedStyle(searchButtonElement).getPropertyValue("--transform-duration"));
searchButtonElement.style.setProperty("pointer-events", "none");
document.querySelector("header").classList.remove("searchboxActive");
// Wait for the transform animation to finish
setTimeout(() => searchButtonElement.style.removeProperty("pointer-events"), transformDuration);
},
openSearchbox: () => { openSearchbox: () => {
document.querySelector("header").classList.add("searchboxActive"); document.querySelector("header").classList.add("searchboxActive");
// Select searchbox inner input element // Select searchbox inner input element