File tree 2 files changed +27
-11
lines changed
packages/@vuepress/theme-default
__tests__/components/__snapshots__
2 files changed +27
-11
lines changed Original file line number Diff line number Diff line change 1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
3
exports [` DropdownLink renders dropdown link. 1` ] = `
4
- <div class = " dropdown-wrapper" ><button type = " button" aria-label = " Learn More Select" class = " dropdown-title" ><span class = " title" >Learn More</span > <span class = " arrow right" ></span ></button >
4
+ <div class = " dropdown-wrapper" ><button type = " button" aria-label = " Learn More Select" class = " dropdown-title" ><span class = " title" >Learn More</span > <span class = " arrow down " ></ span ></ button > < button type = " button " aria-label = " Learn More Select " class = " mobile-dropdown-title " >< span class = " title " >Learn More</ span > < span class = " arrow right" ></span ></button >
5
5
<ul class = " nav-dropdown" style = " display: none;" name = " dropdown" >
6
6
<li class = " dropdown-item" >
7
7
<!----> <a class = " nav-link" >
Original file line number Diff line number Diff line change 7
7
class =" dropdown-title"
8
8
type =" button"
9
9
: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"
10
21
@click =" setOpen(!open)"
11
22
>
12
23
<span class =" title" >{{ item.text }}</span >
@@ -105,6 +116,11 @@ export default {
105
116
106
117
isLastItemOfArray (item , array ) {
107
118
return last (array) === item
119
+ },
120
+
121
+ handleDropdown () {
122
+ const isTriggerByTab = event .detail === 0
123
+ if (isTriggerByTab) this .setOpen (! this .open )
108
124
}
109
125
}
110
126
}
@@ -130,6 +146,13 @@ export default {
130
146
vertical-align middle
131
147
margin-top - 1px
132
148
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
133
156
.nav-dropdown
134
157
.dropdown-item
135
158
color inherit
@@ -175,10 +198,9 @@ export default {
175
198
& .open .dropdown-title
176
199
margin-bottom 0.5rem
177
200
.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
182
204
.nav-dropdown
183
205
transition height .1s ease-out
184
206
overflow hidden
@@ -203,12 +225,6 @@ export default {
203
225
display block !important
204
226
& .open : blur
205
227
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
212
228
.nav-dropdown
213
229
display none
214
230
// Avoid height shaked by clicking
You can’t perform that action at this time.
0 commit comments