Skip to content
Permalink
Browse files
fix(b-link): don't render target or rel attrs when router-tag o…
…ther than `a` or `area` provided (#5107)

Co-authored-by: Jacob Müller
  • Loading branch information
tmorehouse committed Apr 6, 2020
1 parent 404d6e8 commit 33c6cefc2f46ab8110e39f110d984f230d525c86
Showing 1 changed file with 6 additions and 10 deletions.
@@ -149,23 +149,19 @@ export const BLink = /*#__PURE__*/ Vue.extend({
}
},
render(h) {
const { active, disabled, target, routerTag, isRouterLink } = this
const tag = this.computedTag
const rel = this.computedRel
const href = this.computedHref
const isRouterLink = this.isRouterLink

const componentData = {
class: { active: this.active, disabled: this.disabled },
class: { active, disabled },
attrs: {
...this.$attrs,
rel,
target: this.target,
tabindex: this.disabled
? '-1'
: isUndefined(this.$attrs.tabindex)
? null
: this.$attrs.tabindex,
'aria-disabled': this.disabled ? 'true' : null
// We don't render `rel` or `target` on non link tags when using `vue-router`
...(isRouterLink && routerTag !== 'a' && routerTag !== 'area' ? {} : { rel, target }),
tabindex: disabled ? '-1' : isUndefined(this.$attrs.tabindex) ? null : this.$attrs.tabindex,
'aria-disabled': disabled ? 'true' : null
},
props: this.computedProps
}

0 comments on commit 33c6cef

Please sign in to comment.