Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

Improve keyboard accessibility and navigation shortcuts (#466)

LearningCircuitcad1e28cf57a
diff --git a/src/local_deep_research/__version__.py b/src/local_deep_research/__version__.py
index 43a1e95ba4..6b27eeebfd 100644
--- a/src/local_deep_research/__version__.py
+++ b/src/local_deep_research/__version__.py
@@ -1 +1 @@
-__version__ = "0.5.3"
+__version__ = "0.5.4"
diff --git a/src/local_deep_research/web/static/css/styles.css b/src/local_deep_research/web/static/css/styles.css
index 7978bbfa85..40d009e7c3 100644
--- a/src/local_deep_research/web/static/css/styles.css
+++ b/src/local_deep_research/web/static/css/styles.css
@@ -119,6 +119,18 @@ a:hover {
color: var(--text-primary);
}
+.sidebar-nav li a:focus {
+ outline: 2px solid var(--accent-primary);
+ outline-offset: -2px;
+ background-color: var(--bg-tertiary);
+ color: var(--text-primary);
+}
+
+.sidebar-nav li a:focus .nav-shortcut {
+ background-color: var(--accent-primary);
+ color: var(--text-primary);
+}
+
.sidebar-nav li.active {
color: var(--accent-primary);
background-color: rgba(110, 79, 246, 0.1);
@@ -130,13 +142,53 @@ a:hover {
color: inherit;
}
+/* Navigation shortcuts */
+.nav-shortcut {
+ margin-left: auto;
+ background-color: var(--bg-tertiary);
+ color: var(--text-muted);
+ padding: 0.2rem 0.5rem;
+ border-radius: 4px;
+ font-size: 0.75rem;
+ font-weight: 600;
+ min-width: 1.5rem;
+ text-align: center;
+ transition: all 0.2s;
+}
+
+.sidebar-nav li:hover .nav-shortcut {
+ background-color: var(--accent-primary);
+ color: var(--text-primary);
+}
+
+.sidebar-nav li.active .nav-shortcut {
+ background-color: var(--accent-primary);
+ color: var(--text-primary);
+}
+
.sidebar-footer {
padding: 1rem 1.5rem;
border-top: 1px solid var(--border-color);
color: var(--text-muted);
font-size: 0.875rem;
display: flex;
- justify-content: center;
+ flex-direction: column;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.nav-hint {
+ font-size: 0.75rem;
+ opacity: 0.7;
+ margin: 0;
+}
+
+.nav-hint kbd {
+ background-color: var(--bg-tertiary);
+ padding: 0.1rem 0.3rem;
+ border-radius: 3px;
+ font-size: 0.7rem;
+ border: 1px solid var(--border-color);
}
/* Main Content */
@@ -1046,6 +1098,11 @@ textarea:focus, input[type="text"]:focus {
justify-content: center;
}
+ /* Hide navigation shortcuts on small screens */
+ .nav-shortcut {
+ display: none;
+ }
+
/* Active state fix for icon view */
.sidebar-nav li.active {
border-left-width: 3px;
@@ -1581,6 +1638,10 @@ textarea:focus, input[type="text"]:focus {
border-radius: 8px;
background-color: rgba(64, 191, 255, 0.05);
border: 1px solid rgba(64, 191, 255, 0.1);
+ width: 100%;
+ text-align: left;
+ font-family: inherit;
+ font-size: inherit;
}
.advanced-options-toggle:hover {
@@ -1605,11 +1666,25 @@ textarea:focus, input[type="text"]:focus {
.advanced-options-panel {
background-color: rgba(42, 42, 58, 0.5);
border-radius: 8px;
- padding: 1.5rem;
+ padding: 0 1.5rem;
margin-bottom: 1.5rem;
border: 1px solid var(--border-color);
- display: none;
box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
+ max-height: 0;
+ overflow: hidden;
+ opacity: 0;
+ visibility: hidden;
+ pointer-events: none;
+ transition: all 0.3s ease;
+}
+
+.advanced-options-toggle.open + .advanced-options-panel,
+.advanced-options-panel.expanded {
+ max-height: 1000px;
+ opacity: 1;
+ visibility: visible;
+ pointer-events: auto;
+ padding: 1.5rem;
}
.form-row {
diff --git a/src/local_deep_research/web/static/js/components/custom_dropdown.js b/src/local_deep_research/web/static/js/components/custom_dropdown.js
index b45a7fe7ea..53abec3666 100644
--- a/src/local_deep_research/web/static/js/components/custom_dropdown.js
+++ b/src/local_deep_research/web/static/js/components/custom_dropdown.js
@@ -293,6 +293,18 @@
}
});
+ // Blur event - close dropdown when tabbing away
+ input.addEventListener('blur', (e) => {
+ // Small delay to allow click events on dropdown items to fire first
+ setTimeout(() => {
+ // Check if focus has moved to an element inside the dropdown
+ const activeElement = document.activeElement;
+ if (!dropdownList.contains(activeElement) && activeElement !== input) {
+ hideDropdown();
+ }
+ }, 150);
+ });
+
// Keyboard navigation for dropdown
input.addEventListener('keydown', (e) => {
const items = dropdownList.querySelectorAll('.custom-dropdown-item');
diff --git a/src/local_deep_research/web/static/js/components/research.js b/src/local_deep_research/web/static/js/components/research.js
index eb9a677e33..93e3ed2b9a 100644
--- a/src/local_deep_research/web/static/js/components/research.js
+++ b/src/local_deep_research/web/static/js/components/research.js
@@ -436,8 +436,17 @@
const savedState = localStorage.getItem('advancedOptionsOpen') === 'true';
if (savedState) {
- advancedToggle.classList.add('open', 'expanded');
- advancedToggle.classList.toggle('expanded', true);
+ advancedToggle.classList.add('open');
+ advancedPanel.classList.add('expanded');
+
+ // Update ARIA attributes
+ advancedToggle.setAttribute('aria-expanded', 'true');
+
+ // Update screen reader text
+ const srText = advancedToggle.querySelector('.sr-only');
+ if (srText) {
+ srText.textContent = 'Click to collapse advanced options';
+ }
// Update icon immediately
const icon = advancedToggle.querySelector('i');
@@ -445,8 +454,18 @@
icon.className = 'fas fa-chevron-up';
}
} else {
- advancedToggle.classList.remove('open', 'expanded');
- advancedToggle.classList.toggle('expanded', false);
+ advancedToggle.classList.remove('open');
+ advancedPanel.classList.remove('expanded');
+
+ // Update ARIA attributes
+ advancedToggle.setAttribute('aria-expanded', 'false');
+
+ // Update screen reader text
+ const srText = advancedToggle.querySelector('.sr-only');
+ if (srText) {
+ srText.textContent = 'Click to expand advanced options';
+ }
+
// Ensure icon is correct
const icon = advancedToggle.querySelector('i');
if (icon) {
@@ -460,6 +479,15 @@
const isOpen = advancedToggle.classList.toggle('open');
advancedToggle.classList.toggle('expanded', isOpen);
+ // Update ARIA attributes for accessibility
+ this.setAttribute('aria-expanded', isOpen);
+
+ // Update screen reader text
+ const srText = this.querySelector('.sr-only');
+ if (srText) {
+ srText.textContent = isOpen ? 'Click to collapse advanced options' : 'Click to expand advanced options';
+ }
+
// Save state to localStorage
localStorage.setItem('advancedOptionsOpen', isOpen);
@@ -469,27 +497,40 @@
icon.className = isOpen ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
}
- // Animate using CSS transitions based on the 'expanded' class
- // No need for direct style manipulation or timeouts here if CSS is set up correctly
- // Example: CSS might have transition on max-height and opacity
- // If explicit display toggle is needed for transition logic:
- if (isOpen) {
- advancedPanel.style.display = 'block'; // Show before transition starts
- // Force reflow to ensure display:block is applied before transition
- advancedPanel.offsetHeight;
- advancedPanel.classList.add('expanded'); // Add class to trigger transition
- } else {
- advancedPanel.classList.remove('expanded'); // Remove class to trigger transition
- // Optionally hide with display:none after transition ends (using event listener)
- advancedPanel.addEventListener('transitionend', () => {
- if (!advancedPanel.classList.contains('expanded')) {
- advancedPanel.style.display = 'none';
- }
- }, { once: true });
+ // Update panel expanded class for CSS animation
+ advancedPanel.classList.toggle('expanded', isOpen);
+ });
+
+ // Add keyboard support for the advanced options toggle
+ advancedToggle.addEventListener('keydown', function(event) {
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault();
+ this.click(); // Trigger the click handler
}
});
}
+ // Global keyboard shortcuts for this page
+ document.addEventListener('keydown', function(event) {
+ // Escape key: return focus to search field (override global Esc behavior when on search page)
+ if (event.key === 'Escape') {
+ if (queryInput && document.activeElement !== queryInput) {
+ event.preventDefault();
+ event.stopPropagation(); // Prevent global keyboard service from handling this
+ queryInput.focus();
+ queryInput.select(); // Select all text for easy replacement
+ }
+ }
+
+ // Ctrl/Cmd + Enter: submit form from anywhere on the page
+ if ((event.ctrlKey || event.metaKey) && event.key === 'Enter') {
+ if (form) {
+ event.preventDefault();
+ handleResearchSubmit(new Event('submit'));
+ }
+ }
+ });
+
// Form submission
form.addEventListener('submit', handleResearchSubmit);
@@ -505,15 +546,21 @@
selectMode(this);
} else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {
event.preventDefault();
- const previousMode = this.previousElementSibling;
- if (previousMode && previousMode.classList.contains('mode-option')) {
+ // Find the previous mode option, skipping hidden inputs
+ const allModeOptions = Array.from(document.querySelectorAll('.mode-option'));
+ const currentIndex = allModeOptions.indexOf(this);
+ const previousMode = allModeOptions[currentIndex - 1];
+ if (previousMode) {
selectMode(previousMode);
previousMode.focus();
}
} else if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {
event.preventDefault();
- const nextMode = this.nextElementSibling;
- if (nextMode && nextMode.classList.contains('mode-option')) {
+ // Find the next mode option, skipping hidden inputs
+ const allModeOptions = Array.from(document.querySelectorAll('.mode-option'));
+ const currentIndex = allModeOptions.indexOf(this);
+ const nextMode = allModeOptions[currentIndex + 1];
+ if (nextMode) {
selectMode(nextMode);
nextMode.focus();
}
diff --git a/src/local_deep_research/web/static/js/services/keyboard.js b/src/local_deep_research/web/static/js/services/keyboard.js
index 504510f58b..fbb32263e9 100644
--- a/src/local_deep_research/web/static/js/services/keyboard.js
+++ b/src/local_deep_research/web/static/js/services/keyboard.js
@@ -8,12 +8,40 @@
// Keyboard shortcut registry - simplified to just the essential ones
const shortcuts = {
'newSearch': {
- keys: ['ctrl+enter', 'cmd+enter'],
+ keys: ['escape'],
description: 'Return to main search',
handler: () => {
// Always navigate to main research page
window.location.href = '/';
}
+ },
+ 'navNewResearch': {
+ keys: ['ctrl+shift+1'],
+ description: 'Go to New Research',
+ handler: () => {
+ window.location.href = '/';
+ }
+ },
+ 'navHistory': {
+ keys: ['ctrl+shift+2'],
+ description: 'Go to History',
+ handler: () => {
+ window.location.href = '/research/history';
+ }
+ },
+ 'navMetrics': {
+ keys: ['ctrl+shift+3'],
+ description: 'Go to Metrics',
+ handler: () => {
+ window.location.href = '/metrics';
+ }
+ },
+ 'navSettings': {
+ keys: ['ctrl+shift+4'],
+ description: 'Go to Settings',
+ handler: () => {
+ window.location.href = '/research/settings';
+ }
}
};
@@ -39,7 +67,7 @@
// Match key
const eventKey = event.key.toLowerCase();
- if (eventKey !== key && event.code.toLowerCase() !== `key${key}`) {
+ if (eventKey !== key && event.code.toLowerCase() !== `key${key}` && event.code.toLowerCase() !== `digit${key}`) {
// Special handling for special keys
if (key === '/' && eventKey !== '/') return false;
else if (key === ',' && eventKey !== ',') return false;
@@ -70,9 +98,22 @@
activeElement.contentEditable === 'true'
);
- // Allow Escape even when typing
- if (isTyping && event.key !== 'Escape') {
- return;
+ // Skip shortcuts when typing, except for navigation shortcuts and Esc (unless on settings page)
+ if (isTyping) {
+ const isNavShortcut = event.ctrlKey && event.shiftKey && (
+ ['1', '2', '3', '4'].includes(event.key) ||
+ ['Digit1', 'Digit2', 'Digit3', 'Digit4'].includes(event.code)
+ );
+ const isEscOnSettingsPage = event.key === 'Escape' && window.location.pathname.includes('/settings');
+
+ // Debug navigation shortcuts
+ if (event.ctrlKey && event.shiftKey) {
+ console.log('Nav shortcut attempt:', event.key, event.code, 'isNavShortcut:', isNavShortcut);
+ }
+
+ if (!isNavShortcut && (event.key !== 'Escape' || isEscOnSettingsPage)) {
+ return;
+ }
}
// Debug log
diff --git a/src/local_deep_research/web/templates/pages/research.html b/src/local_deep_research/web/templates/pages/research.html
index f9f7bba781..e2618cf7b8 100644
--- a/src/local_deep_research/web/templates/pages/research.html
+++ b/src/local_deep_research/web/templates/pages/research.html
@@ -35,7 +35,11 @@
</span>
<span class="hint-item">
<i class="fas fa-home hint-icon"></i>
- <span class="hint-text"><kbd>Ctrl</kbd>+<kbd>Enter</kbd> returns here from anywhere</span>
+ <span class="hint-text"><kbd>Esc</kbd> returns here from anywhere</span>
+ </span>
+ <span class="hint-item">
+ <i class="fas fa-bars hint-icon"></i>
+ <span class="hint-text"><kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>1-4</kbd> to navigate menu</span>
</span>
</div>
</div>
@@ -65,13 +69,14 @@
</fieldset>
</div>
- <!-- Advanced Options -->
- <div class="advanced-options-toggle">
+ <!-- Advanced Options - positioned before start for configuration -->
+ <button type="button" class="advanced-options-toggle" aria-expanded="false" aria-controls="advanced-options-panel">
<span class="toggle-text">Advanced Options</span>
- <i class="fas fa-chevron-down"></i>
- </div>
+ <i class="fas fa-chevron-down" aria-hidden="true"></i>
+ <span class="sr-only">Click to expand advanced options</span>
+ </button>
- <div class="advanced-options-panel">
+ <div class="advanced-options-panel" id="advanced-options-panel" aria-labelledby="advanced-options-toggle">
<div class="form-row">
<!-- Model Provider Selection -->
<div class="form-group half">
@@ -151,6 +156,12 @@
</div>
</div>
+ <!-- Start Research Button -->
+ <div class="form-actions">
+ <button type="submit" class="btn btn-primary" id="start-research-btn"><i class="fas fa-rocket"></i> Start Research</button>
+ </div>
+
+ <!-- Audio Notifications -->
<div class="form-options">
<div class="form-option">
<label for="notification-toggle" class="checkbox-label">
@@ -159,10 +170,6 @@
</label>
</div>
</div>
-
- <div class="form-actions">
- <button type="submit" class="btn btn-primary" id="start-research-btn"><i class="fas fa-rocket"></i> Start Research</button>
- </div>
</form>
</div>
</div>