Skip to content

Commit

Permalink
fix: overlap navbar dropdown menus
Browse files Browse the repository at this point in the history
  • Loading branch information
billyyyyy3320 committed May 2, 2020
1 parent 1114ade commit 1a01c2b
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions packages/@vuepress/theme-default/components/DropdownLink.vue
Expand Up @@ -7,6 +7,17 @@
class="dropdown-title"
type="button"
:aria-label="dropdownAriaLabel"
@click="handleDropdown"
>
<span class="title">{{ item.text }}</span>
<span
class="arrow down"
/>
</button>
<button
class="mobile-dropdown-title"
type="button"
:aria-label="dropdownAriaLabel"
@click="setOpen(!open)"
>
<span class="title">{{ item.text }}</span>
Expand Down Expand Up @@ -105,6 +116,11 @@ export default {
isLastItemOfArray (item, array) {
return last(array) === item
},
handleDropdown () {
const isTriggerByTab = event.detail === 0
if (isTriggerByTab) this.setOpen(!this.open)
}
}
}
Expand All @@ -130,6 +146,13 @@ export default {
vertical-align middle
margin-top -1px
margin-left 0.4rem
.mobile-dropdown-title
@extends .dropdown-title
display none
font-weight 600
font-size inherit
&:hover
color $accentColor
.nav-dropdown
.dropdown-item
color inherit
Expand Down Expand Up @@ -175,10 +198,9 @@ export default {
&.open .dropdown-title
margin-bottom 0.5rem
.dropdown-title
font-weight 600
font-size inherit
&:hover
color $accentColor
display: none
.mobile-dropdown-title
display: block
.nav-dropdown
transition height .1s ease-out
overflow hidden
Expand All @@ -203,12 +225,6 @@ export default {
display block !important
&.open:blur
display none
.dropdown-title .arrow
// make the arrow always down at desktop
border-left 4px solid transparent
border-right 4px solid transparent
border-top 6px solid $arrowBgColor
border-bottom 0
.nav-dropdown
display none
// Avoid height shaked by clicking
Expand Down

0 comments on commit 1a01c2b

Please sign in to comment.