diff --git a/src/scripts/renderer.ts b/src/scripts/renderer.ts index 8f0f468c..cbdda42e 100644 --- a/src/scripts/renderer.ts +++ b/src/scripts/renderer.ts @@ -412,6 +412,7 @@ try { let defaultSize = parseInt(loc("WebClipper.FontSize.Preview.SansSerifDefault", "16px"), 10); if (defaultSize > 0) { articleFontSize = defaultSize; } } catch (e) { /* keep default 16 */ } +updateFontSizeButtonStates(); // Document title is set unconditionally; the page title and source URL arrive // in the loadContent port message and are populated there (no session-storage @@ -1429,6 +1430,11 @@ function applyArticleFontSize() { pDoc.body.style.fontSize = articleFontSize + "px"; } +function updateFontSizeButtonStates() { + fontDecreaseBtn.setAttribute("aria-disabled", articleFontSize <= 8 ? "true" : "false"); + fontIncreaseBtn.setAttribute("aria-disabled", articleFontSize >= 72 ? "true" : "false"); +} + function initHighlighter() { // Parent-window script operating on the sandboxed (allow-same-origin) preview-frame. createHighlighterInstance(); @@ -1525,12 +1531,14 @@ fontDecreaseBtn.addEventListener("click", () => { if (articleFontSize <= 8) { return; } articleFontSize -= 2; applyArticleFontSize(); + updateFontSizeButtonStates(); announceToScreenReader(strings.decreaseFontSize); }); fontIncreaseBtn.addEventListener("click", () => { if (articleFontSize >= 72) { return; } articleFontSize += 2; applyArticleFontSize(); + updateFontSizeButtonStates(); announceToScreenReader(strings.increaseFontSize); }); diff --git a/src/styles/renderer.less b/src/styles/renderer.less index 6126ee4c..b2894de7 100644 --- a/src/styles/renderer.less +++ b/src/styles/renderer.less @@ -161,8 +161,9 @@ iframe#preview-frame { color: @colorNeutralForeground1; cursor: pointer; border-radius: 4px; height: 28px; vertical-align: middle; padding: 0; transition: background 0.1s; - &:hover:not(.active) { background: @colorSubtleBackgroundHover; } + &:hover:not(.active):not([aria-disabled="true"]) { background: @colorSubtleBackgroundHover; } &:focus { outline: 2px solid @focusRingColor !important; outline-offset: 2px; } + &[aria-disabled="true"] { opacity: 0.4; cursor: default; } &.active { background: @colorSubtleBackgroundHover; border-color: @colorCompoundBrandBackground;