Skip to content
Snippets Groups Projects
Commit 5666ed3a authored by shamalainen's avatar shamalainen
Browse files

Add focus effect when search modal is opened

parent 8622b9b6
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,7 @@
@include font-size(14px, 24px);
border-radius: 0;
border: 1px solid var(--grayscale-medium-dark);
caret-color: var(--brand-main-light);
font-weight: bold;
height: 40px;
letter-spacing: normal;
......@@ -78,7 +79,6 @@
border-style: solid inset solid solid;
border-width: 2px;
outline: 0;
text-indent: -1px; // Text stays in place.
}
}
......
......@@ -100,9 +100,11 @@ export class SiteSearch {
const searchPanel = this.el.shadowRoot.querySelectorAll(`.site-search__panel`)[0] as HTMLElement;
searchPanel.style.top = headerHeight;
// @todo add blinking effect.
const searchInput = this.el.shadowRoot.querySelector('input#search') as HTMLElement;
searchInput.focus();
// Without setTimeout it will not focus the input because it hasn't rendered yet.
setTimeout(() => {
const searchInput = this.el.shadowRoot.querySelector('input#search') as HTMLElement;
searchInput.focus();
});
}
event.stopPropagation();
}
......
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