Skip to content

Commit

Permalink
fix: cv-tabs fails in focusout event when using router-link in a tab (#…
Browse files Browse the repository at this point in the history
…1084)

* fix #1083: cv-tabs fails in focusout event when using router-link in a tab

* fix #1083: fix build errors

Co-authored-by: Lee Chase <leechase@live.com>
  • Loading branch information
Fontinalis and lee-chase committed Dec 11, 2020
1 parent 68a18d5 commit 91adefb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/core/src/components/cv-tabs/cv-tabs.vue
@@ -1,5 +1,5 @@
<template>
<div class="cv-tabs" @focusout="onFocusout" @focusin="onFocusin" style="width: 100%;">
<div class="cv-tabs" ref="tabs" style="width: 100%;">
<div
data-tabs
:class="[`cv-tab ${carbonPrefix}--tabs`, { [`${carbonPrefix}--tabs--container`]: container }]"
Expand Down Expand Up @@ -89,6 +89,14 @@ export default {
this.$on('cv:disabled', srcComponent => this.onCvDisabled(srcComponent));
this.$on('cv:enabled', srcComponent => this.onCvEnabled(srcComponent));
},
mounted() {
this.$refs.tabs.addEventListener('focusout', this.onFocusout);
this.$refs.tabs.addEventListener('focusin', this.onFocusin);
},
beforeDestroy() {
this.$refs.tabs.removeEventListener('focusout', this.onFocusout);
this.$refs.tabs.removeEventListener('focusin', this.onFocusin);
},
computed: {
triggerStyleOverride() {
// <style carbon tweaks - DO NOT USE STYLE TAG as it causes SSR issues
Expand Down

0 comments on commit 91adefb

Please sign in to comment.