Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/assets/javascript/search-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { tokens } from '@rhds/tokens/meta.js';
import '@rhds/elements/rh-badge/rh-badge.js';

const params = new URLSearchParams(location.search);
const searchTerm = params.get('s');
const searchTerm = params.get('search');
// since this is the results page, just search for the query param immediately
const searchResults = fuse.search(searchTerm)?.map(x => x.item);
const searchResults = searchTerm ? fuse.search(searchTerm)?.map(x => x.item) : [];
const results = document.getElementById('results');
const resultsList = document.getElementById('results-list');
const categoryCtas = document.querySelectorAll('.token-category');
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/javascript/search-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function init(form) {
form.addEventListener('submit', event => {
event.preventDefault();
const url = new URL('/tokens/search/', location.origin);
url.searchParams.set('s', search.value);
url.searchParams.set('search', search.value);
location.href = url.href;
});
search.addEventListener('input', async function() {
Expand Down
17 changes: 10 additions & 7 deletions uxdot/uxdot-search.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ input::placeholder {
overflow-y: scroll;
z-index: 2;
grid-column: 1/2;
width: calc(100% + 2 * var(--rh-border-width-md));
inset-block-start: var(--rh-length-2xl);
inset-inline-start: calc(-1 * var(--rh-space-md));
width: calc(100% - 2 * var(--rh-space-sm));
padding: var(--rh-space-sm);
inset-block-start: 100%;
inset-inline-start: 0%;
background: light-dark(var(--rh-color-surface-lightest), var(--rh-color-surface-darkest));
color: var(--rh-color-text-primary);
box-shadow: var(--rh-box-shadow-md);
}

ol {
list-style-type: none;
flex-flow: column nowrap;
padding-inline-start: 0;
border: var(--rh-border-width-sm);
background: var(--rh-color-surface-lightest);
margin: 0;
padding: 0;
border: var(--rh-border-width-sm);
height: calc(100% - var(--rh-space-md));
width: calc(100% - 2 * var(--rh-border-width-md));
}
Expand All @@ -63,5 +65,6 @@ li {

li[aria-selected='true'],
li:focus-within {
outline: var(--rh-border-width-md);
outline: var(--rh-border-width-md) solid var(--rh-color-interactive-primary-default);
background: light-dark(var(--rh-color-surface-lighter), var(--rh-color-surface-darker));
}
1 change: 1 addition & 0 deletions uxdot/uxdot-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class UxdotSearch extends LitElement {
<input id="input"
placeholder="${ifDefined(this.placeholder)}"
role="combobox"
autocomplete="off"
aria-label="${ifDefined(this.#ariaLabel)}"
aria-autocomplete="list"
aria-controls="listbox"
Expand Down