Skip to content

Commit ba96f5b

Browse files
committed
fix a11y, behavior improvement
1 parent cdf7a78 commit ba96f5b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

site/src/components/shortcodes/ComponentFinder.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<svg aria-hidden="true">
99
<use xlink:href="/orange/docs/1.0/assets/img/ouds-web-sprite.svg#heart-empty"></use>
1010
</svg>
11-
<label for="findComponentInput">Find component</label>
11+
<label for="oudsComponentFinderInput">Find component</label>
1212
<input type="search" class="text-input-field" id="oudsComponentFinderInput" placeholder=" " />
1313
</div>
1414
</div>
@@ -20,13 +20,13 @@
2020
<script>
2121
class OudsComponentFinder extends HTMLElement {
2222
connectedCallback() {
23-
const searchInput = this.querySelector('#oudsComponentFinderInput') as HTMLInputElement
23+
const searchInput = document.getElementById('oudsComponentFinderInput') as HTMLInputElement
2424
if (!searchInput) return
25-
searchInput.addEventListener('input', (e: KeyboardEvent) => {
25+
searchInput.addEventListener('input', () => {
2626
setTimeout(() => {
2727
this.querySelectorAll('ul > *').forEach((elt) => elt.classList.remove('d-none'))
2828
if (searchInput.value) {
29-
this.querySelectorAll(`ul > :not([data-name^=${searchInput.value}])`).forEach((elt) =>
29+
this.querySelectorAll(`ul > :not([data-name*=${searchInput.value.toLowerCase()}])`).forEach((elt) =>
3030
elt.classList.add('d-none')
3131
)
3232
}

site/src/content/docs/components.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import fs from 'node:fs'
1818
.pages.map((page) => {
1919
if (page.category && !page.draft) {
2020
return (
21-
<li class="col" data-name={page.title}>
21+
<li class="col" data-name={page.title.toLowerCase()}>
2222
<div class="card position-relative h-100">
2323
<div class="card-top">
2424
<img

0 commit comments

Comments
 (0)