From 38c8017baf76e2e6c73741d5392f6c7ad837ac36 Mon Sep 17 00:00:00 2001 From: konnorrogers Date: Tue, 2 Jul 2024 15:19:55 -0400 Subject: [PATCH] copy / tooltip fixeS --- src/components/copy-button/copy-button.ts | 3 +++ src/components/tooltip/tooltip.ts | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/copy-button/copy-button.ts b/src/components/copy-button/copy-button.ts index 10ca2cede..b8aa862c5 100644 --- a/src/components/copy-button/copy-button.ts +++ b/src/components/copy-button/copy-button.ts @@ -1,5 +1,6 @@ import '../icon/icon.js'; import '../tooltip/tooltip.js'; +import '../visually-hidden/visually-hidden.js'; import { animateWithClass } from '../../internal/animate.js'; import { classMap } from 'lit/directives/class-map.js'; import { customElement, property, query, state } from 'lit/decorators.js'; @@ -201,6 +202,8 @@ export default class WaCopyButton extends WebAwesomeElement { ?disabled=${this.disabled} @click=${this.handleCopy} > + + ${this.currentLabel} diff --git a/src/components/tooltip/tooltip.ts b/src/components/tooltip/tooltip.ts index f792cd944..c19bcf7f4 100644 --- a/src/components/tooltip/tooltip.ts +++ b/src/components/tooltip/tooltip.ts @@ -273,7 +273,12 @@ export default class WaTooltip extends WebAwesomeElement { */ const currentLabel = newAnchor.getAttribute('aria-labelledby') || ''; if (!currentLabel.match(labelRegex)) { - newAnchor.setAttribute('aria-labelledby', currentLabel + ' ' + this.id); + + if (!currentLabel) { + newAnchor.setAttribute('aria-labelledby', this.id); + } else { + newAnchor.setAttribute('aria-labelledby', currentLabel + ' ' + this.id); + } } newAnchor.addEventListener('blur', this.handleBlur, { capture: true, signal });