mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-06-15 14:51:05 +03:00
Fix: admin theme emoji alignment (#6459)
* Fix: admin theme dropdown emoji alignment * Sprites
This commit is contained in:
Vendored
+11
-2
@@ -106,7 +106,11 @@ const showActiveTheme = (theme, focus = false) => {
|
||||
const themeSwitcherText = document.querySelector("#bd-theme-text");
|
||||
const activeThemeIcon = document.querySelector(".theme-icon-active use");
|
||||
const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`);
|
||||
const svgOfActiveBtn = btnToActive.querySelector("span use").textContent;
|
||||
if (!btnToActive) {
|
||||
return;
|
||||
}
|
||||
const btnIconUse = btnToActive ? btnToActive.querySelector("[data-theme-icon-use]") : null;
|
||||
const iconHref = btnIconUse ? btnIconUse.getAttribute("href") || btnIconUse.getAttribute("xlink:href") : null;
|
||||
|
||||
document.querySelectorAll("[data-bs-theme-value]").forEach(element => {
|
||||
element.classList.remove("active");
|
||||
@@ -115,7 +119,12 @@ const showActiveTheme = (theme, focus = false) => {
|
||||
|
||||
btnToActive.classList.add("active");
|
||||
btnToActive.setAttribute("aria-pressed", "true");
|
||||
activeThemeIcon.textContent = svgOfActiveBtn;
|
||||
|
||||
if (iconHref && activeThemeIcon) {
|
||||
activeThemeIcon.setAttribute("href", iconHref);
|
||||
activeThemeIcon.setAttribute("xlink:href", iconHref);
|
||||
}
|
||||
|
||||
const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})`;
|
||||
themeSwitcher.setAttribute("aria-label", themeSwitcherLabel);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user