Skip to content

Commit

Permalink
fix(clipboard): add area-live to announce copied
Browse files Browse the repository at this point in the history
  • Loading branch information
daKmoR committed Aug 1, 2023
1 parent edd25a4 commit 2724570
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/clipboard/clipboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default class SlClipboard extends ShoelaceElement {
return html`
<div
part="base"
aria-live="polite"
class=${classMap({
clipboard: true,
[`clipboard--${this.copyStatus}`]: true
Expand Down
6 changes: 3 additions & 3 deletions src/components/clipboard/clipboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ describe('<sl-clipboard>', () => {
});

it('should reset copyStatus after 2 seconds', async () => {
expect(el.copy).to.be.false;
await el.copy();
expect(el.copyStatus).to.equal('copied');
expect(el.copyStatus).to.equal('trigger');
await el.copy(); // this will result in an error as copy needs to always be called from a user action
expect(el.copyStatus).to.equal('error');
await aTimeout(2100);
expect(el.copyStatus).to.equal('trigger');
});
Expand Down

0 comments on commit 2724570

Please sign in to comment.