spectrum-web-components
spectrum-web-components copied to clipboard
fix(progress-bar): removed duplicate label
Description
Removes duplicate label from progress bar.
Related issue(s)
- fixes #4225
How has this been tested?
- [ ] Test case 1
- Go here
- Right click the first progress bar example and choose Inspect Element
- From the Element Inspector click on the progress bar HTML and select Edit HTML
- Replace the existing progress bar HTML the following HTML:
<sp-progress-bar label="" size="m" indeterminate ></sp-progress-bar>. - Click Enter.
- Verify that the new progress bar displayed has no label.
- Right click the new progress bar's HTML and choose Add Attribute.
- Type the attribute
label="label1". - Click Enter.
- Verify that the progress bar label displays as
label1notlabel1label1.
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)
Checklist
- [x] I have signed the Adobe Open Source CLA.
- [x] My code follows the code style of this project.
- [ ] If my change required a change to the documentation, I have updated the documentation in this pull request.
- [x] I have read the CONTRIBUTING document.
- [x] I have added tests to cover my changes. (Note: Testing won't allow an empty an empty label, so I can't test for this.)
- [x] All new and existing tests passed.
- [x] I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
Branch preview
Visual regression test results
When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
- High Contrast Mode | Medium | LTR
- Spectrum | Lightest | Medium | LTR
- Spectrum | Lightest | Medium | RTL
- Spectrum | Lightest | Large | LTR
- Spectrum | Lightest | Large | RTL
- Spectrum | Light | Medium | LTR
- Spectrum | Light | Medium | RTL
- Spectrum | Light | Large | LTR
- Spectrum | Light | Large | RTL
- Spectrum | Dark | Medium | LTR
- Spectrum | Dark | Medium | RTL
- Spectrum | Dark | Large | LTR
- Spectrum | Dark | Large | RTL
- Spectrum | Darkest | Medium | LTR
- Spectrum | Darkest | Medium | RTL
- Spectrum | Darkest | Large | LTR
- Spectrum | Darkest | Large | RTL
- Express | Lightest | Medium | LTR
- Express | Lightest | Medium | RTL
- Express | Lightest | Large | LTR
- Express | Lightest | Large | RTL
- Express | Light | Medium | LTR
- Express | Light | Medium | RTL
- Express | Light | Large | LTR
- Express | Light | Large | RTL
- Express | Dark | Medium | LTR
- Express | Dark | Medium | RTL
- Express | Dark | Large | LTR
- Express | Dark | Large | RTL
- Express | Darkest | Medium | LTR
- Express | Darkest | Medium | RTL
- Express | Darkest | Large | LTR
- Express | Darkest | Large | RTL
- Spectrum-two | Light | Medium | LTR
- Spectrum-two | Light | Medium | RTL
- Spectrum-two | Light | Large | LTR
- Spectrum-two | Light | Large | RTL
- Spectrum-two | Dark | Medium | LTR
- Spectrum-two | Dark | Medium | RTL
- Spectrum-two | Dark | Large | LTR
- Spectrum-two | Dark | Large | RTL
Lighthouse scores
| Category | Latest (report) | Main (report) | Branch (report) |
|---|---|---|---|
| Performance | 0.99 | 0.99 | 0.99 |
| Accessibility | 1 | 1 | 1 |
| Best Practices | 1 | 1 | 1 |
| SEO | 1 | 0.92 | 0.92 |
| PWA | 1 | 1 | 1 |
What is this?
Lighthouse scores comparing the documentation site built from the PR ("Branch") to that of the production documentation site ("Latest") and the build currently on main ("Main"). Higher scores are better, but note that the SEO scores on Netlify URLs are artifically constrained to 0.92.
Transfer Size
| Category | Latest | Main | Branch |
|---|---|---|---|
| Total | 225.257 kB | 212.067 kB | 210.626 kB 🏆 |
| Scripts | 57.363 kB | 49.723 kB | 48.303 kB 🏆 |
| Stylesheet | 34.881 kB | 30.341 kB 🏆 | 30.406 kB |
| Document | 6.152 kB | 5.338 kB | 5.304 kB 🏆 |
| Font | 126.861 kB | 126.665 kB | 126.613 kB 🏆 |
Request Count
| Category | Latest | Main | Branch |
|---|---|---|---|
| Total | 48 | 48 | 45 🏆 |
| Scripts | 40 | 40 | 37 🏆 |
| Stylesheet | 5 | 5 | 5 |
| Document | 1 | 1 | 1 |
| Font | 2 | 2 | 2 |
Tachometer results
Chrome
progress-bar permalink
basic-test
| Version | Bytes | Avg Time | vs remote | vs branch |
|---|---|---|---|---|
| npm latest | 408 kB | 29.06ms - 29.75ms | - | slower ❌ 2% - 5% 0.46ms - 1.40ms |
| branch | 395 kB | 28.16ms - 28.79ms | faster ✔ 2% - 5% 0.46ms - 1.40ms |
- |
Firefox
progress-bar permalink
basic-test
| Version | Bytes | Avg Time | vs remote | vs branch |
|---|---|---|---|---|
| npm latest | 408 kB | 62.04ms - 69.08ms | - | slower ❌ 0% - 13% 0.20ms - 7.92ms |
| branch | 395 kB | 59.92ms - 63.08ms | faster ✔ 1% - 12% 0.20ms - 7.92ms |
- |
@nikkimk Can you catch up to main and add some documentation on this?
Can we add a relevant test for this
I have added a couple of tests and updated the logic as well
Think about how this will render
<sp-progress-bar label="Loading" indeterminate>abcdefgh</sp-progress-bar>
@Rajdeepc What is the desired behavior for this use case?
Think about how this will render
<sp-progress-bar label="Loading" indeterminate>content</sp-progress-bar>@Rajdeepc What is the desired behavior for this use case?
In this case <sp-progress-bar label="Loading" indeterminate>abcdefgh</sp-progress-bar> when both label is present and content are present then, both of them will exist inside slot sp-field-label which is logically not so correct.
Either of them should be present in sp-filed-label. There shouldn't be a scenario when both label and slot content are present inside slot
Think about how this will render
<sp-progress-bar label="Loading" indeterminate>content</sp-progress-bar>@Rajdeepc What is the desired behavior for this use case?
In this case
<sp-progress-bar label="Loading" indeterminate>abcdefgh</sp-progress-bar>when both label is present and content are present then, both of them will exist insideslotsp-field-labelwhich is logically not so correct. Either of them should be present insp-filed-label. There shouldn't be a scenario when bothlabelandslot contentare present insideslot
So when both are present, is the attribute the only one that should exist?
Think about how this will render
<sp-progress-bar label="Loading" indeterminate>content</sp-progress-bar>@Rajdeepc What is the desired behavior for this use case?
In this case
<sp-progress-bar label="Loading" indeterminate>abcdefgh</sp-progress-bar>when both label is present and content are present then, both of them will exist insideslotsp-field-labelwhich is logically not so correct. Either of them should be present insp-filed-label. There shouldn't be a scenario when bothlabelandslot contentare present insideslotSo when both are present, is the attribute the only one that should exist?
When both are present only the content should exist which in the above example is 'abcdefgh'.
When both are present only the content should exist which in the above example is 'abcdefgh'.
@Rajdeepc To make sure I'm understanding, is the following correct?
If label attribute is |
and default slot is |
then what appears visually should be | and the aria-label should be |
|---|---|---|---|
| empty | content |
content |
content |
abcdefgh |
empty | abcdefgh |
abcdefgh |
abcdefgh |
content |
content |
abcdefgh |
| empty | empty | empty | empty |
abcdefgh
In the third row when both label="abcdefgh" and content are present, then what appears visually should becontent
@blunteshwar
abcdefgh
In the third row when both label="abcdefgh" and content are present, then what appears visually should be
content
What about the aria-label? Ideally sighted screenreader users should hear and see the same content?
@blunteshwar
abcdefgh
In the third row when both label="abcdefgh" and content are present, then what appears visually should be
contentWhat about the aria-label? Ideally sighted screenreader users should hear and see the same content?
Indeed
I think we have to make sure that when content is present then, aria-label =content.
Making sure I capture that part of our discussion revolved around this previous issue: https://github.com/adobe/spectrum-web-components/issues/3146 and whether or not this is how progress bar should work.
Making sure I capture that part of our discussion revolved around this previous issue: #3146 and whether or not this is how progress bar should work.
I think since this is a part of a longer discussion chain, how do we feel we fix the related bug of duplicate label and take this in a follow up work?