mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
copy / tooltip fixeS
This commit is contained in:
@@ -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}
|
||||
>
|
||||
<!-- Render a visually hidden label to appease the accessibility checking gods -->
|
||||
<wa-visually-hidden>${this.currentLabel}</wa-visually-hidden>
|
||||
<slot part="copy-icon" name="copy-icon">
|
||||
<wa-icon library="system" name="copy" variant="regular" fixed-width></wa-icon>
|
||||
</slot>
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user