Skip to content

Commit

Permalink
Updated toggle for mobile navigation
Browse files Browse the repository at this point in the history
Previously, the only way to close the navigation in Ghost Admin on mobile was to tap outside of the menu, on the background. With this change, you can also tap the 'More' button, or navigate to any other menu item, to have the menu overlaid on top close itself again.

fixes https://linear.app/ghost/issue/DES-993/the-slide-out-panel-inside-ghosts-admin-on-mobile-lacks-intuitive
  • Loading branch information
dvdwinden committed Dec 11, 2024
1 parent bd20ad3 commit 851117f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ghost/admin/app/components/gh-mobile-nav-bar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@
<LinkTo @route="posts">{{svg-jar "content" data-test-mobile-nav="posts"}}Posts</LinkTo>
{{/if}}
<LinkTo @route="members" class="gh-nav-main-users" data-test-mobile-nav="members">{{svg-jar "members"}}Members</LinkTo>
<div role="button" class="gh-mobile-nav-bar-more" {{action "openMobileMenu" target=this.ui data-test-mobile-nav="more"}}>{{svg-jar "icon" class="icon-gh"}}More</div>
<div
role="button"
class="gh-mobile-nav-bar-more"
{{on "click" (fn this.ui.toggleMobileMenu)}}
data-test-mobile-nav="more"
>
{{svg-jar "icon" class="icon-gh"}}More
</div>
{{yield}}
5 changes: 5 additions & 0 deletions ghost/admin/app/services/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,9 @@ export default class UiService extends Service {
document.body.removeEventListener('dragend', this.cancelDrag, {capture: true});
document.body.removeEventListener('drop', this.cancelDrag, {capture: true});
}

@action
toggleMobileMenu() {
this.showMobileMenu = !this.showMobileMenu;
}
}

0 comments on commit 851117f

Please sign in to comment.