* docs: rename FONT_MANAGER_USAGE.md to FONT_MANAGER.md Renamed for clearer naming convention. Part of documentation consolidation effort. * docs: consolidate Plugin Store guides (2→1) Merged: - PLUGIN_STORE_USER_GUIDE.md - PLUGIN_STORE_QUICK_REFERENCE.md Into: PLUGIN_STORE_GUIDE.md - Unified writing style to professional technical - Added Quick Reference section at top for easy access - Removed duplicate content - Added cross-references to related documentation - Updated formatting to match style guidelines * docs: create user-focused Web Interface Guide Created WEB_INTERFACE_GUIDE.md consolidating: - V3_INTERFACE_README.md (technical details) - User-facing interface documentation - Focused on end-user tasks and navigation - Removed technical implementation details - Added common tasks section - Included troubleshooting - Professional technical writing style * docs: consolidate WiFi setup guides (4→1) Merged: - WIFI_SETUP.md - OPTIMAL_WIFI_AP_FAILOVER_SETUP.md - AP_MODE_MANUAL_ENABLE.md - WIFI_ETHERNET_AP_MODE_FIX.md (behavior documentation) Into: WIFI_NETWORK_SETUP.md - Comprehensive coverage of WiFi setup and configuration - Clear explanation of AP mode failover and grace period - Configuration scenarios and best practices - Troubleshooting section combining all sources - Professional technical writing style - Added quick reference table for behavior * docs: consolidate troubleshooting guides (4→1) Merged: - TROUBLESHOOTING_QUICK_START.md - WEB_INTERFACE_TROUBLESHOOTING.md - CAPTIVE_PORTAL_TROUBLESHOOTING.md - WEATHER_TROUBLESHOOTING.md Into: TROUBLESHOOTING.md - Organized by issue category (web, WiFi, plugins) - Comprehensive diagnostic commands reference - Quick diagnosis steps at the top - Service file template preserved - Complete diagnostic script included - Professional technical writing style * docs: create consolidated Advanced Features guide Merged: - VEGAS_SCROLL_MODE.md - ON_DEMAND_DISPLAY_QUICK_START.md - ON_DEMAND_DISPLAY_API.md - ON_DEMAND_CACHE_MANAGEMENT.md - BACKGROUND_SERVICE_README.md - PERMISSION_MANAGEMENT_GUIDE.md Into: ADVANCED_FEATURES.md - Comprehensive guide covering all advanced features - Vegas scroll mode with integration examples - On-demand display with API reference - Cache management troubleshooting - Background service documentation - Permission management patterns - Professional technical writing style * docs: create Getting Started guide for first-time users Created GETTING_STARTED.md: - Quick start guide (5 minutes) - Initial configuration walkthrough - Common first-time issues and solutions - Next steps and quick reference - User-friendly tone for beginners - Links to detailed documentation * docs: archive consolidated source files and ephemeral docs Archived files that have been consolidated: - Plugin Store guides (2 files → PLUGIN_STORE_GUIDE.md) - Web Interface guide (V3_INTERFACE_README.md → WEB_INTERFACE_GUIDE.md) - WiFi Setup guides (4 files → WIFI_NETWORK_SETUP.md) - Troubleshooting guides (4 files → TROUBLESHOOTING.md) - Advanced Features (6 files → ADVANCED_FEATURES.md) Archived ephemeral/debug documentation: - DEBUG_WEB_ISSUE.md - BROWSER_ERRORS_EXPLANATION.md - FORM_VALIDATION_FIXES.md - WEB_UI_RELIABILITY_IMPROVEMENTS.md - CAPTIVE_PORTAL_TESTING.md - NEXT_STEPS_COMMANDS.md - STATIC_IMAGE_MULTI_UPLOAD_PLAN.md - RECONNECT_AFTER_CAPTIVE_PORTAL_TESTING.md Archived implementation summaries: - PLUGIN_CONFIG_TABS_SUMMARY.md - PLUGIN_CONFIG_SYSTEM_VERIFICATION.md - PLUGIN_SCHEMA_AUDIT_SUMMARY.md - STARTUP_OPTIMIZATION_SUMMARY.md - PLUGIN_DISPATCH_IMPLEMENTATION.md - NESTED_SCHEMA_IMPLEMENTATION.md - AP_MODE_MANUAL_ENABLE_CHANGES.md - PLUGIN_CONFIG_SYSTEM_EXPLANATION.md Total archived: 27 files Preserves git history while cleaning up main docs directory * docs: rename API_REFERENCE.md to REST_API_REFERENCE.md Renamed for clarity - this is specifically the REST API reference for the web interface, not a general API reference. * docs: update README.md to reflect consolidated documentation structure Updated documentation index: - Reflects new consolidated guides (51 → 16-17 files) - Updated Quick Start sections with new file names - Added consolidation history (January 2026) - Updated file references (API_REFERENCE → REST_API_REFERENCE) - Documented archival of 33 files - Added benefits of consolidation - Updated statistics and highlights - Removed outdated references - Professional writing style maintained throughout * docs: add Vegas scroll mode system architecture documentation Added comprehensive internal architecture section for Vegas mode: - Component overview with diagram - VegasModeCoordinator responsibilities and main loop - StreamManager buffering strategy and content flow - PluginAdapter integration and fallback behavior - RenderPipeline 125 FPS rendering process - Component interaction flows - Thread safety patterns - Performance characteristics Covers: - How the four components work together - Initialization and render loop flows - Config update handling - Frame rate management and optimization - Memory usage and CPU characteristics --------- Co-authored-by: Chuck <chuck@example.com>
6.0 KiB
Form Validation Fixes - Preventing "Invalid Form Control" Errors
Problem
Browser was throwing errors: "An invalid form control with name='...' is not focusable" when:
- Number inputs had values outside their min/max constraints
- These fields were in collapsed/hidden nested sections
- Browser couldn't focus hidden invalid fields to show validation errors
Root Cause
- Value Clamping Missing: Number inputs were generated with values that didn't respect min/max constraints
- HTML5 Validation on Hidden Fields: Browser validation tried to validate hidden fields but couldn't focus them
- No Pre-Submit Validation: Forms didn't fix invalid values before submission
Fixes Applied
1. Plugin Configuration Form (plugins.html)
File: web_interface/templates/v3/partials/plugins.html
Changes:
- ✅ Added value clamping in
generateFieldHtml()(lines 1825-1844)- Clamps values to min/max when generating number inputs
- Uses default value if provided
- Ensures all generated fields have valid values
- ✅ Added
novalidateattribute to form (line 1998) - ✅ Added pre-submit validation fix in
handlePluginConfigSubmit()(lines 1518-1533)- Fixes any invalid values before processing form data
- Prevents "invalid form control is not focusable" errors
2. Plugin Config in Base Template (base.html)
File: web_interface/templates/v3/base.html
Changes:
- ✅ Added value clamping in number input generation (lines 1386-1407)
- Same logic as plugins.html
- Clamps values to min/max constraints
- ✅ Fixed display_duration input (line 1654)
- Uses
Math.max(5, Math.min(300, value))to clamp value
- Uses
- ✅ Added global
fixInvalidNumberInputs()function (lines 2409-2425)- Can be called from any form's onsubmit handler
- Fixes invalid number inputs before submission
3. Display Settings Form (display.html)
File: web_interface/templates/v3/partials/display.html
Changes:
- ✅ Added
novalidateattribute to form (line 13) - ✅ Added
onsubmit="fixInvalidNumberInputs(this); return true;"(line 14) - ✅ Added local
fixInvalidNumberInputs()function as fallback (lines 260-278)
4. Durations Form (durations.html)
File: web_interface/templates/v3/partials/durations.html
Changes:
- ✅ Added
novalidateattribute to form (line 13) - ✅ Added
onsubmit="fixInvalidNumberInputs(this); return true;"(line 14)
Implementation Details
Value Clamping Logic
// Ensure value respects min/max constraints
let fieldValue = value !== undefined ? value : (prop.default !== undefined ? prop.default : '');
if (fieldValue !== '' && fieldValue !== undefined && fieldValue !== null) {
const numValue = typeof fieldValue === 'string' ? parseFloat(fieldValue) : fieldValue;
if (!isNaN(numValue)) {
// Clamp value to min/max if constraints exist
if (prop.minimum !== undefined && numValue < prop.minimum) {
fieldValue = prop.minimum;
} else if (prop.maximum !== undefined && numValue > prop.maximum) {
fieldValue = prop.maximum;
} else {
fieldValue = numValue;
}
}
}
Pre-Submit Validation Fix
// Fix invalid hidden fields before submission
const allInputs = form.querySelectorAll('input[type="number"]');
allInputs.forEach(input => {
const min = parseFloat(input.getAttribute('min'));
const max = parseFloat(input.getAttribute('max'));
const value = parseFloat(input.value);
if (!isNaN(value)) {
if (!isNaN(min) && value < min) {
input.value = min;
} else if (!isNaN(max) && value > max) {
input.value = max;
}
}
});
Files Modified
-
✅
web_interface/templates/v3/partials/plugins.html- Value clamping in field generation
novalidateon forms- Pre-submit validation fix
-
✅
web_interface/templates/v3/base.html- Value clamping in field generation
- Fixed display_duration input
- Global
fixInvalidNumberInputs()function
-
✅
web_interface/templates/v3/partials/display.htmlnovalidateon formonsubmithandler- Local fallback function
-
✅
web_interface/templates/v3/partials/durations.htmlnovalidateon formonsubmithandler
Prevention Strategy
For Future Forms
-
Always clamp number input values when generating forms:
// Clamp value to min/max if (min !== undefined && value < min) value = min; if (max !== undefined && value > max) value = max; -
Add
novalidateto forms that use custom validation:<form novalidate onsubmit="fixInvalidNumberInputs(this); return true;"> -
Use the global helper for pre-submit validation:
window.fixInvalidNumberInputs(form); -
Check for hidden fields - If fields can be hidden (collapsed sections), ensure:
- Values are valid when fields are generated
- Pre-submit validation fixes any remaining issues
- Form has
novalidateto prevent HTML5 validation
Testing
Test Cases
- ✅ Number input with value=0, min=60 → Should clamp to 60
- ✅ Number input with value=1000, max=600 → Should clamp to 600
- ✅ Hidden field with invalid value → Should be fixed on submit
- ✅ Form submission with invalid values → Should fix before submit
- ✅ Nested sections with number inputs → Should work correctly
Manual Testing
- Open plugin configuration with nested sections
- Collapse a section with number inputs
- Try to submit form → Should work without errors
- Check browser console → Should have no validation errors
Related Issues
- Issue: "An invalid form control with name='...' is not focusable"
- Cause: Hidden fields with invalid values (outside min/max)
- Solution: Value clamping + pre-submit validation +
novalidate
Notes
- We use
novalidatebecause we do server-side validation anyway - The pre-submit fix is a safety net for any edge cases
- Value clamping at generation time prevents most issues
- All fixes are backward compatible