-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
d4d0380
commit ceb0fa9
Showing
2 changed files
with
33 additions
and
11 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...ages/@vuepress/theme-default/__tests__/components/__snapshots__/DropdownLink.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
@@ -105,6 +116,17 @@ export default { | |
isLastItemOfArray (item, array) { | ||
return last(array) === item | ||
}, | ||
/** | ||
* Open the dropdown when user tab and click from keyboard. | ||
* | ||
* Use event.detail to detect tab and click from keyboard. Ref: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail | ||
* The Tab + Click is UIEvent > KeyboardEvent, so the detail is 0. | ||
*/ | ||
handleDropdown () { | ||
const isTriggerByTab = event.detail === 0 | ||
if (isTriggerByTab) this.setOpen(!this.open) | ||
} | ||
} | ||
} | ||
|
@@ -130,6 +152,13 @@ export default { | |
vertical-align middle | ||
margin-top -1px | ||
margin-left 0.4rem | ||
.mobile-dropdown-title | ||
@extends .dropdown-title | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
FarhiaM
|
||
display none | ||
font-weight 600 | ||
font-size inherit | ||
&:hover | ||
color $accentColor | ||
.nav-dropdown | ||
.dropdown-item | ||
color inherit | ||
|
@@ -175,10 +204,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 | ||
|
@@ -203,12 +231,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 | ||
|
Not sure that it happens for everyone. But this line breaks our vuepress build.
Here is our vuepress project:Β https://github.com/cgwire/kitsu/tree/docs