Enhance accessibility menu by adding Screen Reader and Voice Command options, and update styles for improved visual feedback.

This commit is contained in:
sinanisler
2025-12-21 21:18:41 +03:00
parent 587f8108c3
commit 2e304842e1
+29 -17
View File
@@ -274,6 +274,7 @@ const styles = `
}
.snn-close:hover {
color: ${WIDGET_CONFIG.colors.text};
background:${WIDGET_CONFIG.colors.secondary};
}
.snn-header {
display: flex;
@@ -1216,7 +1217,7 @@ function createAccessibilityMenu() {
const header = document.createElement('div');
header.classList.add('snn-header');
const title = document.createElement('h2');
const title = document.createElement('div');
title.classList.add('snn-title');
title.id = 'snn-accessibility-title';
title.textContent = WIDGET_CONFIG.lang.accessibilityTools;
@@ -1259,22 +1260,6 @@ function createAccessibilityMenu() {
// Add accessibility options based on configuration
const options = [
{
text: WIDGET_CONFIG.lang.screenReader,
key: 'screenReader',
customToggleFunction: screenReader.toggle,
icon: icons.screenReader,
requiresFeature: screenReader,
enabled: WIDGET_CONFIG.enableScreenReader,
},
{
text: WIDGET_CONFIG.lang.voiceCommand,
key: 'voiceControl',
customToggleFunction: voiceControl.toggle,
icon: icons.voiceControl,
requiresFeature: voiceControl,
enabled: WIDGET_CONFIG.enableVoiceControl,
},
{
text: WIDGET_CONFIG.lang.textSpacing,
key: 'textSpacing',
@@ -1368,6 +1353,33 @@ function createAccessibilityMenu() {
optionsGrid.appendChild(highContrastButton);
}
// Add Screen Reader and Voice Command as the LAST two buttons
if (WIDGET_CONFIG.enableScreenReader) {
const screenReaderButton = createToggleButton(
WIDGET_CONFIG.lang.screenReader,
'screenReader',
null,
document.body,
screenReader.toggle,
icons.screenReader,
screenReader
);
optionsGrid.appendChild(screenReaderButton);
}
if (WIDGET_CONFIG.enableVoiceControl) {
const voiceControlButton = createToggleButton(
WIDGET_CONFIG.lang.voiceCommand,
'voiceControl',
null,
document.body,
voiceControl.toggle,
icons.voiceControl,
voiceControl
);
optionsGrid.appendChild(voiceControlButton);
}
// Add grid to content
content.appendChild(optionsGrid);