From 3730ab7c22776b93e4ce990a530504eb93358f81 Mon Sep 17 00:00:00 2001 From: xaralis <filip.varecha@fragaria.cz> Date: Sat, 18 Jul 2020 13:54:28 +0200 Subject: [PATCH] Fix issue rendering navbar main item with subitems unclickable --- source/js/components/navbar/NavbarSubitem.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/js/components/navbar/NavbarSubitem.vue b/source/js/components/navbar/NavbarSubitem.vue index a3b550e..09d953c 100644 --- a/source/js/components/navbar/NavbarSubitem.vue +++ b/source/js/components/navbar/NavbarSubitem.vue @@ -1,6 +1,7 @@ <template> <div @mouseenter="onMouseEnter" @mouseleave="onMouseLeave"> - <span class="navbar-menu__link navbar-menu__submenu-toggle" :class="{'navbar-menu__submenu-toggle--open': show}" @click="handleClick">{{ label }}</span> + <span v-if="!href" class="navbar-menu__link navbar-menu__submenu-toggle" :class="{'navbar-menu__submenu-toggle--open': show}" @click="handleClick">{{ label }}</span> + <a v-if="href" :href="href" class="navbar-menu__link navbar-menu__submenu-toggle" :class="{'navbar-menu__submenu-toggle--open': show}" @click.prevent="handleClick">{{ label }}</a> <div :class="{'navbar-menu__submenu-wrap--show': show}" class="navbar-menu__submenu-wrap"> <slot> </slot> @@ -36,9 +37,12 @@ export default { this.$data.show = false; } }, - handleClick() { - if (this.$props.href) { - window.location = this.$props.href; + handleClick(evt) { + // On mobile screens, first click should just toggle and redir on second one + if (isLgScreenSize() || this.$data.show) { + if (this.$props.href) { + window.location = this.$props.href; + } } this.$data.show = !this.$data.show; -- GitLab