From: Alexander Schwartz Date: Thu, 17 Jan 2019 22:58:48 +0000 (+0100) Subject: make focus behave like hover for the navigation. Using :focus-within for dropdown... X-Git-Tag: 0.7.5~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d3aad5467289b7bc92de33a015a7a96235bbf76;p=thirdparty%2Fbulma.git make focus behave like hover for the navigation. Using :focus-within for dropdown menu. --- diff --git a/sass/components/navbar.sass b/sass/components/navbar.sass index dc90dd9d3..7b97edb2f 100644 --- a/sass/components/navbar.sass +++ b/sass/components/navbar.sass @@ -69,6 +69,7 @@ $navbar-breakpoint: $desktop !default color: $color-invert & > a.navbar-item, .navbar-link + &:focus, &:hover, &.is-active background-color: darken($color, 5%) @@ -86,6 +87,7 @@ $navbar-breakpoint: $desktop !default color: $color-invert & > a.navbar-item, .navbar-link + &:focus, &:hover, &.is-active background-color: darken($color, 5%) @@ -93,6 +95,7 @@ $navbar-breakpoint: $desktop !default .navbar-link &::after border-color: $color-invert + .navbar-item.has-dropdown:focus .navbar-link, .navbar-item.has-dropdown:hover .navbar-link, .navbar-item.has-dropdown.is-active .navbar-link background-color: darken($color, 5%) @@ -135,6 +138,7 @@ body .navbar-brand a.navbar-item + &:focus, &:hover background-color: transparent @@ -167,6 +171,8 @@ body a.navbar-item, .navbar-link cursor: pointer + &:focus, + &:focus-within, &:hover, &.is-active background-color: $navbar-item-hover-background-color @@ -187,6 +193,7 @@ a.navbar-item, border-bottom: 1px solid transparent min-height: $navbar-height padding-bottom: calc(0.5rem - 1px) + &:focus, &:hover background-color: $navbar-tab-hover-background-color border-bottom-color: $navbar-tab-hover-border-bottom-color @@ -286,16 +293,20 @@ a.navbar-item, &.is-transparent a.navbar-item, .navbar-link + &:focus, &:hover, &.is-active background-color: transparent !important .navbar-item.has-dropdown &.is-active, + &.is-hoverable:focus, + &.is-hoverable:focus-within, &.is-hoverable:hover .navbar-link background-color: transparent !important .navbar-dropdown a.navbar-item + &:focus, &:hover background-color: $navbar-dropdown-item-hover-background-color color: $navbar-dropdown-item-hover-color @@ -323,6 +334,8 @@ a.navbar-item, box-shadow: 0 -8px 8px rgba($black, 0.1) top: auto &.is-active, + &.is-hoverable:focus, + &.is-hoverable:focus-within, &.is-hoverable:hover .navbar-dropdown display: block @@ -358,6 +371,7 @@ a.navbar-item, white-space: nowrap a.navbar-item padding-right: 3rem + &:focus, &:hover background-color: $navbar-dropdown-item-hover-background-color color: $navbar-dropdown-item-hover-color @@ -413,9 +427,10 @@ a.navbar-item, .navbar-link &.is-active color: $navbar-item-active-color - &.is-active:not(:hover) + &.is-active:not(:focus):not(:hover) background-color: $navbar-item-active-background-color .navbar-item.has-dropdown + &:focus, &:hover, &.is-active .navbar-link