Skip to content

Commit 97fa713

Browse files
authored
Merge branch 'main' into fix/jump-links/sr-headings
2 parents e5ed1ec + 6c03120 commit 97fa713

File tree

10 files changed

+249
-139
lines changed

10 files changed

+249
-139
lines changed

.changeset/breezy-bikes-smell.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
"@patternfly/pfe-clipboard": major
3+
---
4+
5+
Update pfe-clipboard to function with mouse, keyboard, and screen reader and meet WCAG 2.1 A - AA Guidelines ✨♿
6+
7+
BREAKING CHANGE:
8+
`role="button"` and `tabindex=0` attributes must *no longer* be applied to `<pfe-clipboard>`, make sure all instances
9+
on your page are updated
10+
11+
```diff
12+
- <pfe-clipboard role="button" tabindex="0"></pfe-clipboard>
13+
+ <pfe-clipboard></pfe-clipboard>
14+
```
15+
16+
`pfe-clipboard.spec.ts`
17+
- Updated tests based on a11y changes
18+
19+
`README.md`
20+
- Updated readme based on a11y updates
21+
22+
`pfe-clipboard.ts`
23+
- Added new state property for aria-disabled to added aria features
24+
- Added comments for changes
25+
- Updated the HTML in render() to add aria features
26+
- Cleaned up some comment typos
27+
28+
`pfe-clipboard.scss`
29+
- Added sr-only class to utilize with pfe-clipboard to improve the success message output for screen readers
30+
- Adjusted the padding and changes some ids to be classes to go with new HTML structure
31+
32+
`pfe-clipboard.html`
33+
- Removed role button and tabindex from pfe-clipboard tags because that is being set within the shadowDom now
34+
pfe-clipboard.js
35+
- Removed role button and tabindex from pfe-clipboard tags because that is being set within the shadowDom now
36+
37+
See [docs](https://patternflyelements.org/components/clipboard/) for more info

.github/workflows/autoupdate.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/_includes/layout-blog-index.njk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ layout: layout-base.njk
1515
{% for post in collections.blog %}
1616
<pfe-card>
1717
<h2 slot="header">{{ post.data.title }}</h2>
18-
{{ post.data | log }}
1918
{% if post.data.tagline %}<p class="tagline">{{ post.data.tagline }}</p>{% endif %}
2019
{% if post.data.description %}
2120
{{ post.data.description }}

elements/pfe-clipboard/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import '@patternfly/pfe-clipboard';
2828

2929
### Default
3030
```html
31-
<pfe-clipboard role="button" tabindex="0"></pfe-clipboard>
31+
<pfe-clipboard></pfe-clipboard>
3232
```
3333

3434
### Copy text from an element on the page
@@ -38,51 +38,51 @@ Add a valid HTML selector to the target attribute, component will use `document.
3838
We recommend using ID's.
3939

4040
```html
41-
<pfe-clipboard role="button" tabindex="0" copy-from="#copy-me"></pfe-clipboard>
41+
<pfe-clipboard copy-from="#copy-me"></pfe-clipboard>
4242
<div id="copy-me">This text will get copied</div>
4343

44-
<pfe-clipboard role="button" tabindex="0" copy-from="body .copy-me"></pfe-clipboard>
44+
<pfe-clipboard copy-from="body .copy-me"></pfe-clipboard>
4545
<div class="copy-me">This text will get copied</div>
4646
```
4747

4848
### Copy arbitrary content
4949
Set the attribute `copy-from="property"` and set the property `contentToCopy` on the component with what should be copied.
5050
```html
5151
<!-- Markup on the page -->
52-
<pfe-clipboard role="button" tabindex="0" copy-from="property" id="copyButton"></pfe-clipboard>
52+
<pfe-clipboard copy-from="property" id="copyButton"></pfe-clipboard>
5353
```
5454
```js
5555
document.getElementById('copyButton').contentToCopy('Wakka wakka!');
5656
```
5757

5858
### Optionally hide the icon
5959
```html
60-
<pfe-clipboard no-icon role="button" tabindex="0"></pfe-clipboard>
60+
<pfe-clipboard no-icon></pfe-clipboard>
6161
```
6262

6363
### Override the link text
6464
```html
65-
<pfe-clipboard role="button" tabindex="0">
65+
<pfe-clipboard>
6666
<span slot="label">hey you, copy this url!</span>
6767
</pfe-clipboard>
6868
```
6969

7070
### Override the copied notification text
7171
```html
72-
<pfe-clipboard role="button" tabindex="0">
72+
<pfe-clipboard>
7373
<span slot="success">URL Copied to clipboard</span>
7474
</pfe-clipboard>
7575
```
7676
### Override the icon
7777
```html
78-
<pfe-clipboard role="button" tabindex="0">
78+
<pfe-clipboard>
7979
<pfe-icon slot="icon" icon="web-icon-globe"></pfe-icon>
8080
</pfe-clipboard>
8181
```
8282

8383
## Override all slots
8484
```html
85-
<pfe-clipboard role="button" tabindex="0">
85+
<pfe-clipboard>
8686
<span slot="label">Copy this article URL</span>
8787
<span slot="success">URL Copied to clipboard</span>
8888
<pfe-icon slot="icon" icon="web-icon-globe"></pfe-icon>
@@ -91,7 +91,7 @@ document.getElementById('copyButton').contentToCopy('Wakka wakka!');
9191

9292
## Specify the amount of seconds the copy success text should be visible
9393
```html
94-
<pfe-clipboard role="button" tabindex="0" copied-duration="5"></pfe-clipboard>
94+
<pfe-clipboard copied-duration="5"></pfe-clipboard>
9595
```
9696

9797
### Accessibility

elements/pfe-clipboard/demo/pfe-clipboard.html

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,96 +16,104 @@
1616
<p>This element embeds a copy url button on your site.</p>
1717

1818
<h2>Clipboard</h2>
19-
<pfe-clipboard role="button" tabindex="0"></pfe-clipboard>
19+
<pfe-clipboard></pfe-clipboard>
2020

2121
<h2>Clipboard with no icon</h2>
22-
<pfe-clipboard no-icon role="button" tabindex="0"></pfe-clipboard>
22+
<pfe-clipboard no-icon></pfe-clipboard>
2323

2424
<h2>Clipboard: with custom icon</h2>
25-
<pfe-clipboard role="button" tabindex="0">
25+
<pfe-clipboard>
2626
<pfe-icon slot="icon" icon="web-icon-globe"></pfe-icon>
2727
</pfe-clipboard>
2828

2929
<h2>Clipboard: with custom text & copying text from element</h2>
30-
<pfe-clipboard role="button" tabindex="0" copy-from="#textToCopy">
30+
<pfe-clipboard copy-from="#textToCopy">
3131
<span slot="label">This will copy the text in the text field below!</span>
3232
<span slot="success">Making some copies!</span>
3333
</pfe-clipboard>
34-
<input type="text" id="textToCopy" aria-label="This text will be copied" value="This text will be copied!!11"></input>
34+
<input type="text" id="textToCopy" aria-label="This text will be copied." value="This text will be copied!!"></input>
3535

3636
<h2>Clipboard: Copying text from property</h2>
37-
<pfe-clipboard role="button" tabindex="0" copy-from="property" id="propertyCopy">
37+
<pfe-clipboard copy-from="property" id="propertyCopy">
3838
</pfe-clipboard>
3939

4040
<h2>Clipboard: with custom success text duration.</h2>
41-
<pfe-clipboard role="button" tabindex="0" copied-duration="5"></pfe-clipboard>
41+
<pfe-clipboard copied-duration="5"></pfe-clipboard>
42+
43+
<h2>Clipboard: with invalid success text duration.</h2>
44+
<p>Defaults to 4 seconds.</p>
45+
<pfe-clipboard copied-duration="-1"></pfe-clipboard>
46+
47+
<h2>Clipboard: with invalid success text duration, lower than 4 seconds</h2>
48+
<p>Defaults to 4 seconds.</p>
49+
<pfe-clipboard copied-duration="1"></pfe-clipboard>
4250
</pfe-band>
4351

4452
<pfe-band color="darkest">
4553
<p>This element embeds a copy url button on your site.</p>
4654

4755
<h2>Clipboard</h2>
48-
<pfe-clipboard role="button" tabindex="0"></pfe-clipboard>
56+
<pfe-clipboard></pfe-clipboard>
4957

5058
<h2>Clipboard with no icon</h2>
51-
<pfe-clipboard no-icon role="button" tabindex="0"></pfe-clipboard>
59+
<pfe-clipboard no-icon></pfe-clipboard>
5260

5361
<h2>Clipboard: with custom icon</h2>
54-
<pfe-clipboard role="button" tabindex="0">
62+
<pfe-clipboard>
5563
<pfe-icon slot="icon" icon="web-icon-globe"></pfe-icon>
5664
</pfe-clipboard>
5765

5866
<h2>Clipboard: with custom text</h2>
59-
<pfe-clipboard role="button" tabindex="0">
67+
<pfe-clipboard>
6068
<span slot="label">You can totally click to copy url</span>
6169
<span slot="success">Making some copies!</span>
6270
</pfe-clipboard>
6371

6472
<h2>Clipboard: with custom success text duration.</h2>
65-
<pfe-clipboard role="button" tabindex="0" copied-duration="5"></pfe-clipboard>
73+
<pfe-clipboard copied-duration="5"></pfe-clipboard>
6674
</pfe-band>
6775

6876
<pfe-band color="accent">
6977
<p>This element embeds a copy url button on your site.</p>
7078

7179
<h2>Clipboard</h2>
72-
<pfe-clipboard role="button" tabindex="0"></pfe-clipboard>
80+
<pfe-clipboard></pfe-clipboard>
7381

7482
<h2>Clipboard with no icon</h2>
75-
<pfe-clipboard no-icon role="button" tabindex="0"></pfe-clipboard>
83+
<pfe-clipboard no-icon></pfe-clipboard>
7684

7785
<h2>Clipboard: with custom icon</h2>
78-
<pfe-clipboard role="button" tabindex="0">
86+
<pfe-clipboard>
7987
<pfe-icon slot="icon" icon="web-icon-globe"></pfe-icon>
8088
</pfe-clipboard>
8189

8290
<h2>Clipboard: with custom text</h2>
83-
<pfe-clipboard role="button" tabindex="0">
91+
<pfe-clipboard>
8492
<span slot="label">You can totally click to copy url</span>
8593
<span slot="success">Making some copies!</span>
8694
</pfe-clipboard>
8795

8896
<h2>Clipboard: with custom success text duration.</h2>
89-
<pfe-clipboard role="button" tabindex="0" copied-duration="5"></pfe-clipboard>
97+
<pfe-clipboard copied-duration="5"></pfe-clipboard>
9098
</pfe-band>
9199

92100
<pfe-band color="lightest">
93101
<h2>Error cases</h2>
94102

95103
<h3>Set to copy "property", but Property doesn't exist</h3>
96-
<pfe-clipboard role="button" tabindex="0" copy-from="property">
104+
<pfe-clipboard copy-from="property">
97105
<span slot="label">Oops, I didn't set the property to be copied</span>
98106
</pfe-clipboard>
99107

100108
<h3>Set to copy a non-existent selector</h3>
101-
<pfe-clipboard role="button" tabindex="0" copy-from="#wakka-wakka">
109+
<pfe-clipboard copy-from="#wakka-wakka">
102110
<span slot="label">Oops, I didn't set a valid selector to be copied</span>
103111
</pfe-clipboard>
104112

105113
</pfe-band>
106114

107115
<pfe-band color="darkest">
108-
<pfe-clipboard role="button" tabindex="0" copy-from="property">
116+
<pfe-clipboard copy-from="property">
109117
<span slot="label">Oops, I didn't set the property to be copied</span>
110118
</pfe-clipboard>
111119
</pfe-band>

elements/pfe-clipboard/demo/pfe-clipboard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const root = document.querySelector('[data-demo="pfe-clipboard"]')?.shadowRoot ?
66

77
root.getElementById('propertyCopy').contentToCopy = `
88
<h2>Clipboard: with custom text & copying text from element</h2>
9-
<pfe-clipboard role="button" tabindex="0" copy-from="#textToCopy">
9+
<pfe-clipboard copy-from="#textToCopy">
1010
<span slot="text">This will copy the text in the text field below!</span>
1111
<span slot="success">Making some copies!</span>
1212
</pfe-clipboard>
13-
<input type="text" id="textToCopy" value="This text will be copied!!11"></input>
13+
<input type="text" id="textToCopy" value="This text will be copied!!"></input>
1414
`;

0 commit comments

Comments
 (0)