Skip to content

Commit 5ba2b3f

Browse files
keyboard hints
1 parent d6bfb1e commit 5ba2b3f

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

index.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,30 @@
4242
animation: fadeIn 0.3s ease-out;
4343
}
4444

45+
/* macOS-style keyboard hint styling */
46+
.keyboard-hint {
47+
display: inline-flex;
48+
align-items: center;
49+
justify-content: center;
50+
min-width: 20px;
51+
height: 18px;
52+
padding: 0 4px;
53+
font-size: 11px;
54+
font-weight: 500;
55+
color: rgba(255, 255, 255, 0.65);
56+
background-color: rgba(255, 255, 255, 0.15);
57+
border-radius: 3px;
58+
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
59+
text-transform: capitalize;
60+
}
61+
62+
.keyboard-hints-container {
63+
display: flex;
64+
gap: 8px;
65+
color: rgba(255, 255, 255, 0.5);
66+
font-size: 12px;
67+
}
68+
4569
@keyframes fadeIn {
4670
from {
4771
opacity: 0;
@@ -147,6 +171,16 @@
147171
autocomplete="off"
148172
autofocus
149173
/>
174+
<div class="keyboard-hints-container ml-2 flex-shrink-0">
175+
<div class="flex items-center">
176+
<span class="mr-1">search</span>
177+
<div class="keyboard-hint"></div>
178+
</div>
179+
<div class="flex items-center">
180+
<span class="mr-1">clear</span>
181+
<div class="keyboard-hint">Esc</div>
182+
</div>
183+
</div>
150184
</div>
151185

152186
<!-- Results container -->
@@ -893,6 +927,25 @@
893927
loadingIndicator.classList.add("hidden");
894928
emptyState.classList.add("hidden");
895929
initialState.classList.remove("hidden");
930+
} else if (e.key === "Enter" && document.activeElement === searchInput) {
931+
// Trigger search on Enter key if there's text in the search box
932+
const query = searchInput.value.trim();
933+
if (query && !isLoading) {
934+
// Reset pagination and start new search
935+
currentPage = 1;
936+
hasMoreResults = true;
937+
currentQuery = query;
938+
939+
// Show loading indicator and hide other states
940+
resultsContainer.innerHTML = "";
941+
resultsContainer.classList.add("hidden");
942+
loadingIndicator.classList.remove("hidden");
943+
emptyState.classList.add("hidden");
944+
initialState.classList.add("hidden");
945+
946+
// Start search
947+
searchExtensions(query, 1, false);
948+
}
896949
}
897950
});
898951
</script>

0 commit comments

Comments
 (0)