Skip to content

Commit 6adcfc5

Browse files
committed
Add Ctrl+K shortcut to focus search box and update placeholder
1 parent 120222d commit 6adcfc5

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

public/index.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ <h1 class="text-2xl font-bold truncate">takeCode</h1>
2828
</button>
2929
</div>
3030
<div class="relative w-full sm:w-auto mt-2 sm:mt-0 flex-shrink">
31-
<input type="text" id="search" placeholder="Enter RegEx..." class="w-full sm:w-64 px-3 py-2 pr-8 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 transition-colors">
31+
<input type="text" id="search" placeholder="Enter RegEx... (Ctrl+K to focus)" class="w-full sm:w-64 px-3 py-2 pr-8 border border-gray-200 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:placeholder-gray-400 transition-colors">
3232
<button id="clear-search" class="absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors" onclick="clearSearch()" style="display: none;">×</button>
3333
</div>
3434
</header>
@@ -69,6 +69,14 @@ <h1 class="text-2xl font-bold truncate">takeCode</h1>
6969
window.TAKECODE_CONFIG = {
7070
SEARCH_HIGHLIGHT_LIMIT: parseInt('${SEARCH_HIGHLIGHT_LIMIT}') || 3
7171
};
72+
73+
// Keyboard shortcuts
74+
document.addEventListener('keydown', function(e) {
75+
if (e.ctrlKey && e.key === 'k') {
76+
e.preventDefault();
77+
document.getElementById('search').focus();
78+
}
79+
});
7280
</script>
7381
<script type="module" src="js/app.js?v=__VERSION__"></script>
7482

0 commit comments

Comments
 (0)