Skip to content

Commit 3578f9e

Browse files
authored
Merge pull request #40 from IgniteUI/dtsvetkov/fix-search
fix(search): replace commandfor/command API with explicit click handler
2 parents 54381a5 + a4669ba commit 3578f9e

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/components/Search/Search.astro

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import './Search.scss';
1717
class="search-trigger"
1818
aria-label="Search documentation"
1919
title="Search (Ctrl+K)"
20-
commandfor="search-dialog"
21-
command="show-modal"
2220
>
2321
<igc-icon name="search" collection="docs" aria-hidden="true"></igc-icon>
2422
<span class="search-trigger__label">Search</span>
@@ -128,13 +126,8 @@ import './Search.scss';
128126
}
129127
updateSearchHint();
130128

131-
// Declarative show-modal via commandfor fires a `command` event on the dialog —
132-
// use it to load page find and focus the input.
133-
document.addEventListener('command', async (e: Event) => {
134-
const ce = e as CommandEvent;
135-
if (ce.target instanceof HTMLDialogElement && ce.target.id === 'search-dialog') {
136-
await loadAndMountPagefind();
137-
}
129+
document.getElementById('search-trigger')?.addEventListener('click', () => {
130+
openSearch();
138131
});
139132

140133
// Keyboard shortcut

0 commit comments

Comments
 (0)