Fix invalid changes

This commit is contained in:
Ihar Hubchyk
2026-05-02 10:22:36 +08:00
parent 417a19b8c0
commit 7722c1b7c7
+5 -5
View File
@@ -24,8 +24,8 @@ class ThemeManager
// Static properties
static themeToggle = null;
static themeKey = "theme";
static darkTheme = "Evil";
static lightTheme = "Good";
static darkTheme = "dark";
static lightTheme = "light";
static accessibility = null;
// Static initialization method
@@ -57,12 +57,12 @@ class ThemeManager
this.themeToggle.textContent = theme === this.darkTheme ? "☀️ Good Interface" : "🌙 Evil Interface";
// Update ARIA attributes
this.themeToggle.setAttribute( "aria-label", `Switch to ${theme === this.darkTheme ? this.lightTheme : this.darkTheme} Interface` );
this.themeToggle.setAttribute( "aria-label", `Switch to ${theme === this.darkTheme ? this.lightTheme : this.darkTheme} mode` );
this.themeToggle.setAttribute( "aria-pressed", theme === this.darkTheme ? "true" : "false" );
// Announce theme change if accessibility manager is available
if ( this.accessibility ) {
this.accessibility.announce( `${theme === this.darkTheme ? 'Evil' : 'Good'} Interface activated` );
this.accessibility.announce( `${theme === this.darkTheme ? 'Dark' : 'Light'} mode activated` );
}
}
}
@@ -105,7 +105,7 @@ class ThemeManager
if ( this.themeToggle ) {
// Set initial ARIA attributes
const currentTheme = document.documentElement.getAttribute( "data-theme" );
this.themeToggle.setAttribute( "aria-label", `Switch to ${currentTheme === this.darkTheme ? this.lightTheme : this.darkTheme} Interface` );
this.themeToggle.setAttribute( "aria-label", `Switch to ${currentTheme === this.darkTheme ? this.lightTheme : this.darkTheme} mode` );
this.themeToggle.setAttribute( "aria-pressed", currentTheme === this.darkTheme ? "true" : "false" );
// Add keyboard event handling