From 09717f094ff8bec65717a7045604c7c556a4fa48 Mon Sep 17 00:00:00 2001 From: Matteo <193476828+mzner@users.noreply.github.com> Date: Thu, 24 Sep 2026 07:04:51 +0200 Subject: [PATCH] fix: improve contrast on nav item and primary button hover states (#12993) * fix: improve contrast on nav item and primary button hover states Non-active sidebar navigation items and primary-variation buttons (filled and outline appearances) rendered black text/icons on top of a dark brown hover background in the vault theme, producing insufficient contrast. Both now use the text-inverse color for their hover state instead of the primary-contrast token, which resolves correctly across all themes. OCISDEV-1451 * docs: add changelog for nav/primary button hover contrast fix * docs: link changelog entry to PR #12993 --- .../bugfix-nav-primary-button-hover-contrast.md | 12 ++++++++++++ .../src/components/OcButton/OcButton.vue | 11 +++++++++++ .../src/components/SidebarNav/SidebarNavItem.vue | 4 ++-- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 changelog/unreleased/bugfix-nav-primary-button-hover-contrast.md diff --git a/changelog/unreleased/bugfix-nav-primary-button-hover-contrast.md b/changelog/unreleased/bugfix-nav-primary-button-hover-contrast.md new file mode 100644 index 00000000000..6fe2547fdd1 --- /dev/null +++ b/changelog/unreleased/bugfix-nav-primary-button-hover-contrast.md @@ -0,0 +1,12 @@ +Bugfix: fixed low color contrast on nav and primary button hover states + +Non-active sidebar navigation items, as well as buttons using the +"primary" styling, showed their text and icons in black on top of a +dark hover background in some themes, making them hard to read while +hovering. + +The hover state for these elements now switches to a light color +instead of always using black, restoring readable contrast between +the text and the background while hovering. + +https://github.com/owncloud/ocis/pull/12993 diff --git a/web/packages/design-system/src/components/OcButton/OcButton.vue b/web/packages/design-system/src/components/OcButton/OcButton.vue index 7af4584592f..e74187cac08 100644 --- a/web/packages/design-system/src/components/OcButton/OcButton.vue +++ b/web/packages/design-system/src/components/OcButton/OcButton.vue @@ -394,6 +394,17 @@ const handlers = computed(() => { fill: var(--oc-color-swatch-primary-contrast) !important; } } + + &-filled:hover:not([disabled]), + &-filled:focus:not([disabled]), + &-outline:hover:not([disabled]), + &-outline:focus:not([disabled]) { + color: var(--oc-color-text-inverse) !important; + + span > svg { + fill: var(--oc-color-text-inverse) !important; + } + } } &-success { diff --git a/web/packages/web-runtime/src/components/SidebarNav/SidebarNavItem.vue b/web/packages/web-runtime/src/components/SidebarNav/SidebarNavItem.vue index c4c422b3314..6c37daf9c30 100644 --- a/web/packages/web-runtime/src/components/SidebarNav/SidebarNavItem.vue +++ b/web/packages/web-runtime/src/components/SidebarNav/SidebarNavItem.vue @@ -119,10 +119,10 @@ export default defineComponent({ &:hover:not(.active) { background-color: var(--oc-color-swatch-primary-hover) !important; - color: var(--oc-color-swatch-primary-contrast) !important; + color: var(--oc-color-text-inverse) !important; .oc-icon > svg { - fill: var(--oc-color-swatch-primary-contrast); + fill: var(--oc-color-text-inverse); } }