Skip to content

Commit

Permalink
fix(NcButton): use a as tag for router-link
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
  • Loading branch information
raimund-schluessler authored and emoral435 committed Jan 18, 2024
1 parent 862979b commit 22a76f0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/NcButton/NcButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,8 @@ export default {
this)
}
const renderButton = ({ navigate, isActive, isExactActive } = {}) => h((this.to || !this.href) ? 'button' : 'a',
const isLink = (this.to || this.href)
const renderButton = ({ href, navigate, isActive, isExactActive } = {}) => h(isLink ? 'a' : 'button',
{
class: [
'button-vue',
Expand All @@ -640,11 +641,11 @@ export default {
'aria-label': this.ariaLabel,
'aria-pressed': this.pressed,
disabled: this.disabled,
type: this.href ? null : this.nativeType,
role: this.href ? 'button' : null,
href: (!this.to && this.href) ? this.href : null,
target: (!this.to && this.href) ? '_self' : null,
rel: (!this.to && this.href) ? 'nofollow noreferrer noopener' : null,
type: isLink ? null : this.nativeType,
role: isLink ? 'button' : null,
href: this.to ? href : (this.href || null),
target: isLink ? '_self' : null,
rel: isLink ? 'nofollow noreferrer noopener' : null,
download: (!this.to && this.href && this.download) ? this.download : null,
// If this button is used as a popover trigger, we need to apply trigger attrs, e.g. aria attributes
...this.ncPopoverTriggerAttrs,
Expand Down

0 comments on commit 22a76f0

Please sign in to comment.