fix: Prevent button styles from freezing theme by removing direct background, color, and border inheritance.

This commit is contained in:
AEmotionStudio
2026-01-03 04:12:46 -08:00
parent e2965f7a38
commit ef9101e4c2
3 changed files with 16 additions and 10 deletions
+10 -5
View File
@@ -520,11 +520,16 @@ export class UiManager {
btn.style.justifyContent = "center";
btn.style.padding = "0 8px";
btn.style.cursor = "pointer";
btn.style.border = anchorBtn.style.border || computed.border;
btn.style.borderRadius = anchorBtn.style.borderRadius || computed.borderRadius;
// Use cssText if available for background/color specific overrides
if (!btn.style.background) btn.style.background = computed.background;
if (!btn.style.color) btn.style.color = computed.color;
// Copy border radius if available, but avoid copying colors/backgrounds to allow theme switching
if (anchorBtn.style.borderRadius) {
btn.style.borderRadius = anchorBtn.style.borderRadius;
} else {
// Fallback to computed only for structural properties, not colors
btn.style.borderRadius = computed.borderRadius;
}
// Do NOT copy background/color/border from computed styles as they freeze the theme
// Rely on className to handle theme styling
// Add active state tracking
btn.addEventListener('click', () => {
+5 -4
View File
@@ -383,10 +383,11 @@ class UiManager {
btn.style.justifyContent = "center";
btn.style.padding = "0 8px";
btn.style.cursor = "pointer";
btn.style.border = anchorBtn.style.border || computed.border;
btn.style.borderRadius = anchorBtn.style.borderRadius || computed.borderRadius;
if (!btn.style.background) btn.style.background = computed.background;
if (!btn.style.color) btn.style.color = computed.color;
if (anchorBtn.style.borderRadius) {
btn.style.borderRadius = anchorBtn.style.borderRadius;
} else {
btn.style.borderRadius = computed.borderRadius;
}
btn.addEventListener("click", () => {
if (this.onToggle) {
this.onToggle();
File diff suppressed because one or more lines are too long