From abf3224bf1ff8af4d2969833a66b12468538e394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Mon, 6 Oct 2025 15:59:09 +0200 Subject: [PATCH 1/4] ability to parse title --- packages/uui-button/lib/uui-button.element.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/uui-button/lib/uui-button.element.ts b/packages/uui-button/lib/uui-button.element.ts index 43d2237ca..0f4361f8e 100644 --- a/packages/uui-button/lib/uui-button.element.ts +++ b/packages/uui-button/lib/uui-button.element.ts @@ -137,6 +137,15 @@ export class UUIButtonElement extends UUIFormControlMixin( @property({ type: String }) public rel?: string; + /** + * Set the rel attribute for an anchor tag, only used when using href. + * @type {string} + * @attr + * @default undefined + */ + @property({ type: String }) + public title: string = ''; + @query('#button') protected _button!: HTMLInputElement; @@ -237,6 +246,7 @@ export class UUIButtonElement extends UUIFormControlMixin( + aria-label=${ifDefined(this.label)} + title=${ifDefined(this.title)}> ${this.renderState()} ${this.renderLabel()} From 791c448048ca08da885313e4364d59df8fd94aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Mon, 6 Oct 2025 16:00:24 +0200 Subject: [PATCH 2/4] only set title if it has a value --- packages/uui-button/lib/uui-button.element.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uui-button/lib/uui-button.element.ts b/packages/uui-button/lib/uui-button.element.ts index 0f4361f8e..48928b4b4 100644 --- a/packages/uui-button/lib/uui-button.element.ts +++ b/packages/uui-button/lib/uui-button.element.ts @@ -246,7 +246,7 @@ export class UUIButtonElement extends UUIFormControlMixin( + title=${this.title}> ${this.renderState()} ${this.renderLabel()} From 6a97a83ab9fc289a3cf07255d8f6f1d993e6e95c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Mon, 6 Oct 2025 16:00:45 +0200 Subject: [PATCH 3/4] only set title if it has a value --- packages/uui-button/lib/uui-button.element.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uui-button/lib/uui-button.element.ts b/packages/uui-button/lib/uui-button.element.ts index 48928b4b4..9cbd6583a 100644 --- a/packages/uui-button/lib/uui-button.element.ts +++ b/packages/uui-button/lib/uui-button.element.ts @@ -246,7 +246,7 @@ export class UUIButtonElement extends UUIFormControlMixin( + title=${ifDefined(this.title === '' ? undefined : this.title)}> ${this.renderState()} ${this.renderLabel()} From 7647820d4d6b788722b3241e89d13d4ac46ad2f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Mon, 6 Oct 2025 16:03:59 +0200 Subject: [PATCH 4/4] Update packages/uui-button/lib/uui-button.element.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- packages/uui-button/lib/uui-button.element.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uui-button/lib/uui-button.element.ts b/packages/uui-button/lib/uui-button.element.ts index 9cbd6583a..ed6ee978e 100644 --- a/packages/uui-button/lib/uui-button.element.ts +++ b/packages/uui-button/lib/uui-button.element.ts @@ -138,10 +138,10 @@ export class UUIButtonElement extends UUIFormControlMixin( public rel?: string; /** - * Set the rel attribute for an anchor tag, only used when using href. + * Sets the title attribute, which provides a tooltip for both button and anchor elements. * @type {string} * @attr - * @default undefined + * @default '' */ @property({ type: String }) public title: string = '';