Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1a01c2b

Browse files
committedMay 2, 2020
fix: overlap navbar dropdown menus
1 parent 1114ade commit 1a01c2b

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed
 

Diff for: ‎packages/@vuepress/theme-default/components/DropdownLink.vue

+26-10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
class="dropdown-title"
88
type="button"
99
:aria-label="dropdownAriaLabel"
10+
@click="handleDropdown"
11+
>
12+
<span class="title">{{ item.text }}</span>
13+
<span
14+
class="arrow down"
15+
/>
16+
</button>
17+
<button
18+
class="mobile-dropdown-title"
19+
type="button"
20+
:aria-label="dropdownAriaLabel"
1021
@click="setOpen(!open)"
1122
>
1223
<span class="title">{{ item.text }}</span>
@@ -105,6 +116,11 @@ export default {
105116
106117
isLastItemOfArray (item, array) {
107118
return last(array) === item
119+
},
120+
121+
handleDropdown () {
122+
const isTriggerByTab = event.detail === 0
123+
if (isTriggerByTab) this.setOpen(!this.open)
108124
}
109125
}
110126
}
@@ -130,6 +146,13 @@ export default {
130146
vertical-align middle
131147
margin-top -1px
132148
margin-left 0.4rem
149+
.mobile-dropdown-title
150+
@extends .dropdown-title
151+
display none
152+
font-weight 600
153+
font-size inherit
154+
&:hover
155+
color $accentColor
133156
.nav-dropdown
134157
.dropdown-item
135158
color inherit
@@ -175,10 +198,9 @@ export default {
175198
&.open .dropdown-title
176199
margin-bottom 0.5rem
177200
.dropdown-title
178-
font-weight 600
179-
font-size inherit
180-
&:hover
181-
color $accentColor
201+
display: none
202+
.mobile-dropdown-title
203+
display: block
182204
.nav-dropdown
183205
transition height .1s ease-out
184206
overflow hidden
@@ -203,12 +225,6 @@ export default {
203225
display block !important
204226
&.open:blur
205227
display none
206-
.dropdown-title .arrow
207-
// make the arrow always down at desktop
208-
border-left 4px solid transparent
209-
border-right 4px solid transparent
210-
border-top 6px solid $arrowBgColor
211-
border-bottom 0
212228
.nav-dropdown
213229
display none
214230
// Avoid height shaked by clicking

0 commit comments

Comments
 (0)
Please sign in to comment.