Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix($theme-default): close dropdown-links when focusout on the last item (close #1948) #1952

Merged
merged 2 commits into from
Oct 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/@vuepress/theme-default/components/DropdownLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class="dropdown-title"
type="button"
:aria-label="dropdownAriaLabel"
@click="toggle"
@click="setOpen(!open)"
>
<span class="title">{{ item.text }}</span>
<span
Expand Down Expand Up @@ -41,15 +41,15 @@
@focusout="
isLastItemOfArray(childSubItem, subItem.items) &&
isLastItemOfArray(subItem, item.items) &&
toggle()
setOpen(false)
"
:item="childSubItem"/>
</li>
</ul>

<NavLink
v-else
@focusout="isLastItemOfArray(subItem, item.items) && toggle()"
@focusout="isLastItemOfArray(subItem, item.items) && setOpen(false)"
:item="subItem"
/>
</li>
Expand Down Expand Up @@ -86,8 +86,8 @@ export default {
},

methods: {
toggle () {
this.open = !this.open
setOpen (value) {
this.open = value
},

isLastItemOfArray (item, array) {
Expand Down