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.

a11y: add ARIA alert roles + inline error for follow-up modal (#2484)

LearningCircuit128efd784a0c
diff --git a/src/local_deep_research/web/static/css/styles.css b/src/local_deep_research/web/static/css/styles.css
index 22ffabc020..7ccd42516a 100644
--- a/src/local_deep_research/web/static/css/styles.css
+++ b/src/local_deep_research/web/static/css/styles.css
@@ -2647,6 +2647,51 @@ input[type="number"].ldr-form-control::-webkit-inner-spin-button {
color: var(--accent-tertiary);
}
+/* Inline Error Message */
+.ldr-inline-error {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ padding: 0.75rem 1rem;
+ margin-top: 0.5rem;
+ background-color: rgba(var(--error-color-rgb), 0.1);
+ border: 1px solid rgba(var(--error-color-rgb), 0.3);
+ border-radius: 6px;
+ color: var(--error-color);
+ font-size: 0.9rem;
+}
+
+.ldr-inline-error i {
+ flex-shrink: 0;
+}
+
+.ldr-inline-error span {
+ flex: 1;
+}
+
+.ldr-inline-error-close {
+ background: none;
+ border: none;
+ color: var(--error-color);
+ font-size: 1.25rem;
+ line-height: 1;
+ padding: 0;
+ cursor: pointer;
+ opacity: 0.7;
+ transition: opacity 0.2s;
+}
+
+.ldr-inline-error-close:hover {
+ opacity: 1;
+}
+
+.ldr-inline-error-close:focus-visible {
+ outline: 2px solid var(--error-color);
+ outline-offset: 2px;
+ opacity: 1;
+ border-radius: 2px;
+}
+
/* =============================================
Desktop Layout Optimization (Large Screens)
============================================= */
diff --git a/src/local_deep_research/web/static/js/components/fallback/ui.js b/src/local_deep_research/web/static/js/components/fallback/ui.js
index bdd3de80f0..da82b8232d 100644
--- a/src/local_deep_research/web/static/js/components/fallback/ui.js
+++ b/src/local_deep_research/web/static/js/components/fallback/ui.js
@@ -206,12 +206,73 @@
}
}
+ /**
+ * Show an inline error message inside a container element (fallback stub)
+ * Uses DOM API exclusively for XSS safety.
+ * @param {string|Element} container - The container ID or element
+ * @param {string} message - The error message
+ * @param {Object} options - Options { dismissible: true }
+ * @returns {HTMLElement|null} The created error element
+ */
+ function showInlineError(container, message, options = {}) {
+ const containerEl = typeof container === 'string' ? document.getElementById(container) : container;
+ if (!containerEl) {
+ SafeLogger.warn('[fallback ui.showInlineError] Container not found:', container);
+ return null;
+ }
+
+ const { dismissible = true } = options || {};
+
+ clearInlineError(containerEl);
+
+ const errorEl = document.createElement('div');
+ errorEl.className = 'ldr-inline-error';
+ errorEl.setAttribute('role', 'alert');
+
+ const icon = document.createElement('i');
+ icon.className = 'fas fa-exclamation-circle';
+ errorEl.appendChild(icon);
+
+ const span = document.createElement('span');
+ span.textContent = message;
+ errorEl.appendChild(span);
+
+ if (dismissible) {
+ const closeBtn = document.createElement('button');
+ closeBtn.type = 'button';
+ closeBtn.className = 'ldr-inline-error-close';
+ closeBtn.setAttribute('aria-label', 'Dismiss error');
+ closeBtn.textContent = '\u00d7';
+ closeBtn.addEventListener('click', () => {
+ errorEl.remove();
+ });
+ errorEl.appendChild(closeBtn);
+ }
+
+ containerEl.appendChild(errorEl);
+ return errorEl;
+ }
+
+ /**
+ * Clear inline errors from a container (fallback stub)
+ * @param {string|Element} container - The container ID or element
+ */
+ function clearInlineError(container) {
+ const containerEl = typeof container === 'string' ? document.getElementById(container) : container;
+ if (containerEl) {
+ const errors = containerEl.querySelectorAll('.ldr-inline-error');
+ errors.forEach(el => el.remove());
+ }
+ }
+
// Export utilities to window.ui
window.ui = {
showSpinner,
hideSpinner,
showError,
showMessage,
+ showInlineError,
+ clearInlineError,
renderMarkdown,
updateFavicon
};
diff --git a/src/local_deep_research/web/static/js/followup.js b/src/local_deep_research/web/static/js/followup.js
index e36ec80b37..bc1b3cfdca 100644
--- a/src/local_deep_research/web/static/js/followup.js
+++ b/src/local_deep_research/web/static/js/followup.js
@@ -106,6 +106,13 @@ class FollowUpResearch {
if (startBtn) {
startBtn.addEventListener('click', () => this.submitFollowUp());
}
+
+ // Clear stale errors when modal is closed
+ if (this.modalElement) {
+ this.modalElement.addEventListener('hidden.bs.modal', () => {
+ window.ui.clearInlineError('followup-error-container');
+ });
+ }
}
/**
@@ -265,14 +272,16 @@ class FollowUpResearch {
* Submit follow-up research
*/
async submitFollowUp() {
+ window.ui.clearInlineError('followup-error-container');
+
const question = document.getElementById('followUpQuestion').value.trim();
if (!question) {
- alert('Please enter a follow-up question');
+ window.ui.showInlineError('followup-error-container', 'Please enter a follow-up question');
return;
}
if (!this.parentResearchId) {
- alert('No parent research ID available');
+ window.ui.showInlineError('followup-error-container', 'No parent research ID available');
return;
}
@@ -317,11 +326,11 @@ class FollowUpResearch {
// bearer:disable javascript_lang_open_redirect — server-generated UUID in hardcoded /progress/ path
window.location.href = `/progress/${data.research_id}`;
} else {
- alert('Error starting follow-up research: ' + (data.error || 'Unknown error'));
+ window.ui.showInlineError('followup-error-container', 'Error starting follow-up research: ' + (data.error || 'Unknown error'));
}
} catch (error) {
SafeLogger.error('Error submitting follow-up:', error);
- alert('Failed to start follow-up research: ' + error.message);
+ window.ui.showInlineError('followup-error-container', 'Failed to start follow-up research: ' + error.message);
}
}
}
diff --git a/src/local_deep_research/web/static/js/services/ui.js b/src/local_deep_research/web/static/js/services/ui.js
index 6c5bd5cd75..9d06a0f259 100644
--- a/src/local_deep_research/web/static/js/services/ui.js
+++ b/src/local_deep_research/web/static/js/services/ui.js
@@ -478,6 +478,66 @@ function showAlert(message, type = 'info', skipIfToastShown = true) {
}, UI_CONFIG.ALERT_DURATION_MS);
}
+/**
+ * Show an inline error message inside a container element
+ * Uses DOM API exclusively (no innerHTML) for XSS safety.
+ * @param {string|Element} container - The container ID or element
+ * @param {string} message - The error message (used via textContent, inherently safe)
+ * @param {Object} options - Options { dismissible: true }
+ * @returns {HTMLElement|null} The created error element, or null if container not found
+ */
+function showInlineError(container, message, options = {}) {
+ const containerEl = typeof container === 'string' ? document.getElementById(container) : container;
+ if (!containerEl) {
+ SafeLogger.warn('[ui.showInlineError] Container not found:', container);
+ return null;
+ }
+
+ const { dismissible = true } = options || {};
+
+ // Remove any existing inline error in this container
+ clearInlineError(containerEl);
+
+ // Build error element entirely via DOM API
+ const errorEl = document.createElement('div');
+ errorEl.className = 'ldr-inline-error';
+ errorEl.setAttribute('role', 'alert');
+
+ const icon = document.createElement('i');
+ icon.className = 'fas fa-exclamation-circle';
+ errorEl.appendChild(icon);
+
+ const span = document.createElement('span');
+ span.textContent = message;
+ errorEl.appendChild(span);
+
+ if (dismissible) {
+ const closeBtn = document.createElement('button');
+ closeBtn.type = 'button';
+ closeBtn.className = 'ldr-inline-error-close';
+ closeBtn.setAttribute('aria-label', 'Dismiss error');
+ closeBtn.textContent = '\u00d7';
+ closeBtn.addEventListener('click', () => {
+ errorEl.remove();
+ });
+ errorEl.appendChild(closeBtn);
+ }
+
+ containerEl.appendChild(errorEl);
+ return errorEl;
+}
+
+/**
+ * Clear inline errors from a container
+ * @param {string|Element} container - The container ID or element
+ */
+function clearInlineError(container) {
+ const containerEl = typeof container === 'string' ? document.getElementById(container) : container;
+ if (containerEl) {
+ const errors = containerEl.querySelectorAll('.ldr-inline-error');
+ errors.forEach(el => el.remove());
+ }
+}
// Add CSS for alert and notification styles
function addAlertStyles() {
@@ -579,5 +639,7 @@ window.ui = {
renderMarkdown,
createDynamicFavicon,
updateFavicon,
- showAlert
+ showAlert,
+ showInlineError,
+ clearInlineError
};
diff --git a/src/local_deep_research/web/static/templates/followup_modal.html b/src/local_deep_research/web/static/templates/followup_modal.html
index 37a66460ea..8ff9f2b40c 100644
--- a/src/local_deep_research/web/static/templates/followup_modal.html
+++ b/src/local_deep_research/web/static/templates/followup_modal.html
@@ -24,6 +24,8 @@
<small><span id="parentSources"></span> sources available for reuse</small>
</div>
+ <div id="followup-error-container"></div>
+
<div class="mb-3">
<label for="followUpQuestion" class="form-label">Your Follow-up Question:</label>
<textarea
diff --git a/src/local_deep_research/web/templates/pages/benchmark.html b/src/local_deep_research/web/templates/pages/benchmark.html
index 8c8de1ec19..9811b3165d 100644
--- a/src/local_deep_research/web/templates/pages/benchmark.html
+++ b/src/local_deep_research/web/templates/pages/benchmark.html
@@ -654,7 +654,7 @@
{% endcall %}
<!-- Alert container -->
- <div id="benchmark-alert" class="ldr-settings-alert-container" style="display:none"></div>
+ <div id="benchmark-alert" class="ldr-settings-alert-container" role="alert" style="display:none"></div>
<div class="ldr-card ldr-benchmark-card">
<div class="ldr-card-content">
diff --git a/src/local_deep_research/web/templates/pages/benchmark_simple.html b/src/local_deep_research/web/templates/pages/benchmark_simple.html
index 6ceac13568..9175ce137a 100644
--- a/src/local_deep_research/web/templates/pages/benchmark_simple.html
+++ b/src/local_deep_research/web/templates/pages/benchmark_simple.html
@@ -133,7 +133,7 @@
<p class="ldr-page-subtitle">Test your current settings against standard datasets</p>
</div>
- <div id="benchmark-alert" class="ldr-settings-alert-container" style="display:none"></div>
+ <div id="benchmark-alert" class="ldr-settings-alert-container" role="alert" style="display:none"></div>
<div class="ldr-card ldr-benchmark-card">
<div class="ldr-card-content">
diff --git a/src/local_deep_research/web/templates/pages/news-subscription-form.html b/src/local_deep_research/web/templates/pages/news-subscription-form.html
index 2234c90064..4c13835b2b 100644
--- a/src/local_deep_research/web/templates/pages/news-subscription-form.html
+++ b/src/local_deep_research/web/templates/pages/news-subscription-form.html
@@ -80,7 +80,7 @@
</div>
<!-- Alert Container -->
- <div id="subscription-alert" class="ldr-settings-alert-container"></div>
+ <div id="subscription-alert" class="ldr-settings-alert-container" role="alert"></div>
<form id="subscription-form" class="ldr-form-card">
<!-- Basic Information Section -->
diff --git a/src/local_deep_research/web/templates/pages/news.html b/src/local_deep_research/web/templates/pages/news.html
index d1cbfe52b1..c170bf9043 100644
--- a/src/local_deep_research/web/templates/pages/news.html
+++ b/src/local_deep_research/web/templates/pages/news.html
@@ -28,7 +28,7 @@
{% block content %}
<!-- Alert Container -->
-<div id="news-alert" class="ldr-settings-alert-container"></div>
+<div id="news-alert" class="ldr-settings-alert-container" role="alert"></div>
<div class="ldr-news-page-wrapper">
<!-- Main Content Container with Right Sidebar -->
diff --git a/src/local_deep_research/web/templates/pages/news_cleaned.html b/src/local_deep_research/web/templates/pages/news_cleaned.html
index 254d425485..864562f3a1 100644
--- a/src/local_deep_research/web/templates/pages/news_cleaned.html
+++ b/src/local_deep_research/web/templates/pages/news_cleaned.html
@@ -8,7 +8,7 @@
{% block content %}
<!-- Alert Container -->
-<div id="news-alert" class="ldr-settings-alert-container" style="display: none; position: fixed; top: 20px; right: 20px; z-index: 1000;"></div>
+<div id="news-alert" class="ldr-settings-alert-container" role="alert" style="display: none; position: fixed; top: 20px; right: 20px; z-index: 1000;"></div>
<div class="ldr-news-page-wrapper">
<!-- Main Content Container with Right Sidebar -->
diff --git a/src/local_deep_research/web/templates/settings_dashboard.html b/src/local_deep_research/web/templates/settings_dashboard.html
index e5f1616209..05f517740f 100644
--- a/src/local_deep_research/web/templates/settings_dashboard.html
+++ b/src/local_deep_research/web/templates/settings_dashboard.html
@@ -75,7 +75,7 @@
{% endif %}
{% endwith %}
- <div id="settings-alert" style="display:none"></div>
+ <div id="settings-alert" class="ldr-settings-alert-container" role="alert" style="display:none"></div>
<div class="ldr-card">
<div class="ldr-card-content">
diff --git a/tests/settings/golden_master_settings.json b/tests/settings/golden_master_settings.json
index 6705f23017..75446e73d2 100644
--- a/tests/settings/golden_master_settings.json
+++ b/tests/settings/golden_master_settings.json
@@ -15,7 +15,7 @@
},
"app.debug": {
"category": "app_interface",
- "description": "Produces more informative errors when something goes wrong, but may expose sensitive data.",
+ "description": "Produces more informative errors when something goes wrong, but may expose sensitive data. This setting cannot be changed from the UI for security reasons. To enable debug mode, set the environment variable LDR_APP_DEBUG=true or edit server_config.json.",
"editable": false,
"max_value": null,
"min_value": null,