Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(meter, progress-bar, progress-circle): use innerText when label is not provided #3483

Merged
merged 19 commits into from Jul 27, 2023

Conversation

TarunAdobe
Copy link
Contributor

Use innerText when label is not provided (meter, progress-bar, progress-circle)

Description

To improve accessibility, the component should be updated to set the aria-label attribute based on the following conditions:

  • If only label is provided, use the label attribute value as both the aria-label and the visible label (For ProgressBar and Meter).
  • If only textContent is provided, use the textContent as both the aria-label and the visible label for progress bar and Meter. For ProgressCircle use it to update just aria-label since there is no visible label.
  • If both label and textContent are provided, use the label attribute value as the aria-label, and display textContent as the visible label (in the sp-field-label element).

Related issue(s)

Motivation and context

Currently, the component sets the aria-label attribute only if the label attribute is provided. When only textContent is provided, the component doesn't set the aria-label, leading to an accessibility issue flagged by Axe DevTools.

How has this been tested?

  • Test case 1
    1. Go here
    2. Do this
  • Test case 2
    1. Go here
    2. Do this

Screenshots (if appropriate)

Types of changes

  • 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

  • I have signed the Adobe Open Source CLA.
  • 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.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

protected override render(): TemplateResult {
return html`
<sp-field-label size=${this.size} class="label">
${this.slotHasContent ? html`` : this.label}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why an html construct is needed?

packages/progress-bar/src/ProgressBar.ts Outdated Show resolved Hide resolved
packages/progress-bar/src/ProgressBar.ts Show resolved Hide resolved
packages/progress-circle/src/ProgressCircle.ts Outdated Show resolved Hide resolved
packages/progress-circle/src/ProgressCircle.ts Outdated Show resolved Hide resolved
@Rajdeepc
Copy link
Contributor

Good Start!! Also please make sure the tests are updated accordingly if needed.

@Rajdeepc Rajdeepc added the bug Something isn't working label Jul 21, 2023
@github-actions
Copy link

github-actions bot commented Jul 21, 2023

Tachometer results

Chrome

accordion permalink

Version Bytes Avg Time vs remote vs branch
npm latest 396 kB 233.23ms - 235.90ms - faster ✔
0% - 2%
0.75ms - 4.46ms
branch 398 kB 235.89ms - 238.46ms slower ❌
0% - 2%
0.75ms - 4.46ms
-

action-bar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 369 kB 36.93ms - 37.22ms - faster ✔
70% - 70%
85.75ms - 86.80ms
branch 471 kB 122.85ms - 123.86ms slower ❌
231% - 235%
85.75ms - 86.80ms
-

action-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 509 kB 231.19ms - 233.85ms - unsure 🔍
-2% - +0%
-3.60ms - +0.33ms
branch 512 kB 232.71ms - 235.60ms unsure 🔍
-0% - +2%
-0.33ms - +3.60ms
-

action-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 529 kB 135.17ms - 137.29ms - faster ✔
1% - 2%
0.88ms - 3.36ms
branch 532 kB 137.70ms - 138.99ms slower ❌
1% - 2%
0.88ms - 3.36ms
-

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 739 kB 193.41ms - 196.59ms - unsure 🔍
-1% - +1%
-1.41ms - +2.89ms
branch 740 kB 192.81ms - 195.71ms unsure 🔍
-1% - +1%
-2.89ms - +1.41ms
-

avatar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 382 kB 37.08ms - 37.40ms - unsure 🔍
-0% - +1%
-0.19ms - +0.30ms
branch 384 kB 37.00ms - 37.36ms unsure 🔍
-1% - +0%
-0.30ms - +0.19ms
-

badge permalink

Version Bytes Avg Time vs remote vs branch
npm latest 378 kB 50.16ms - 50.75ms - faster ✔
0% - 2%
0.12ms - 0.95ms
branch 380 kB 50.70ms - 51.28ms slower ❌
0% - 2%
0.12ms - 0.95ms
-

button-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 425 kB 120.91ms - 122.44ms - unsure 🔍
-1% - +1%
-1.07ms - +0.93ms
branch 426 kB 121.10ms - 122.40ms unsure 🔍
-1% - +1%
-0.93ms - +1.07ms
-

button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 430 kB 137.83ms - 138.82ms - unsure 🔍
-1% - +0%
-1.56ms - +0.20ms
branch 432 kB 138.28ms - 139.73ms unsure 🔍
-0% - +1%
-0.20ms - +1.56ms
-

card permalink

Version Bytes Avg Time vs remote vs branch
npm latest 492 kB 117.07ms - 118.87ms - unsure 🔍
-1% - +1%
-1.40ms - +1.32ms
branch 494 kB 116.99ms - 119.02ms unsure 🔍
-1% - +1%
-1.32ms - +1.40ms
-

checkbox permalink

Version Bytes Avg Time vs remote vs branch
npm latest 406 kB 73.44ms - 74.18ms - faster ✔
1% - 2%
0.81ms - 1.80ms
branch 408 kB 74.79ms - 75.45ms slower ❌
1% - 2%
0.81ms - 1.80ms
-

color-slider permalink

Version Bytes Avg Time vs remote vs branch
npm latest 439 kB 184.43ms - 185.45ms - unsure 🔍
-0% - +1%
-0.14ms - +1.37ms
branch 440 kB 183.77ms - 184.89ms unsure 🔍
-1% - +0%
-1.37ms - +0.14ms
-

color-wheel permalink

Version Bytes Avg Time vs remote vs branch
npm latest 440 kB 165.52ms - 166.55ms - faster ✔
11% - 12%
21.36ms - 22.90ms
branch 442 kB 187.60ms - 188.74ms slower ❌
13% - 14%
21.36ms - 22.90ms
-

dialog permalink

Version Bytes Avg Time vs remote vs branch
npm latest 432 kB 71.46ms - 72.07ms - unsure 🔍
-2% - +0%
-1.53ms - +0.26ms
branch 434 kB 71.56ms - 73.24ms unsure 🔍
-0% - +2%
-0.26ms - +1.53ms
-

field-label permalink

Version Bytes Avg Time vs remote vs branch
npm latest 373 kB 48.64ms - 49.32ms - unsure 🔍
-1% - +1%
-0.61ms - +0.33ms
branch 375 kB 48.79ms - 49.44ms unsure 🔍
-1% - +1%
-0.33ms - +0.61ms
-

link permalink

Version Bytes Avg Time vs remote vs branch
npm latest 367 kB 28.18ms - 28.44ms - unsure 🔍
-0% - +1%
-0.09ms - +0.28ms
branch 369 kB 28.08ms - 28.34ms unsure 🔍
-1% - +0%
-0.28ms - +0.09ms
-

menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 420 kB 242.73ms - 245.21ms - unsure 🔍
-1% - +1%
-1.99ms - +1.46ms
branch 422 kB 243.03ms - 245.43ms unsure 🔍
-1% - +1%
-1.46ms - +1.99ms
-

meter permalink

Version Bytes Avg Time vs remote vs branch
npm latest 388 kB 85.55ms - 86.22ms - faster ✔
2% - 3%
1.77ms - 2.83ms
branch 390 kB 87.78ms - 88.60ms slower ❌
2% - 3%
1.77ms - 2.83ms
-

number-field permalink

Version Bytes Avg Time vs remote vs branch
npm latest 626 kB 215.14ms - 218.15ms - unsure 🔍
-2% - +0%
-3.94ms - +0.53ms
branch 628 kB 216.70ms - 220.01ms unsure 🔍
-0% - +2%
-0.53ms - +3.94ms
-

overlay permalink

Version Bytes Avg Time vs remote vs branch
npm latest 457 kB 75.32ms - 76.32ms - unsure 🔍
-1% - +1%
-0.89ms - +0.47ms
branch 458 kB 75.58ms - 76.49ms unsure 🔍
-1% - +1%
-0.47ms - +0.89ms
-

picker permalink

Version Bytes Avg Time vs remote vs branch
npm latest 593 kB 650.03ms - 659.04ms - unsure 🔍
-1% - +1%
-4.61ms - +8.63ms
branch 594 kB 647.66ms - 657.38ms unsure 🔍
-1% - +1%
-8.63ms - +4.61ms
-

popover permalink

Version Bytes Avg Time vs remote vs branch
npm latest 366 kB 35.81ms - 36.05ms - unsure 🔍
-1% - +0%
-0.38ms - +0.01ms
branch 368 kB 35.96ms - 36.26ms unsure 🔍
-0% - +1%
-0.01ms - +0.38ms
-

progress-bar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 385 kB 58.23ms - 58.82ms - faster ✔
14% - 15%
9.56ms - 10.59ms
branch 391 kB 68.18ms - 69.02ms slower ❌
16% - 18%
9.56ms - 10.59ms
-

progress-circle permalink

Version Bytes Avg Time vs remote vs branch
npm latest 365 kB 72.94ms - 73.60ms - faster ✔
1% - 3%
1.04ms - 2.05ms
branch 367 kB 74.44ms - 75.19ms slower ❌
1% - 3%
1.04ms - 2.05ms
-

radio permalink

Version Bytes Avg Time vs remote vs branch
npm latest 391 kB 115.25ms - 116.93ms - unsure 🔍
-0% - +2%
-0.32ms - +1.83ms
branch 393 kB 114.67ms - 116.01ms unsure 🔍
-2% - +0%
-1.83ms - +0.32ms
-

search permalink

Version Bytes Avg Time vs remote vs branch
npm latest 469 kB 111.41ms - 112.75ms - unsure 🔍
-1% - +1%
-1.06ms - +0.63ms
branch 470 kB 111.79ms - 112.81ms unsure 🔍
-1% - +1%
-0.63ms - +1.06ms
-

sidenav permalink

Version Bytes Avg Time vs remote vs branch
npm latest 394 kB 403.35ms - 409.44ms - unsure 🔍
-1% - +1%
-2.59ms - +6.06ms
branch 396 kB 401.59ms - 407.73ms unsure 🔍
-1% - +1%
-6.06ms - +2.59ms
-

slider permalink

Version Bytes Avg Time vs remote vs branch
npm latest 452 kB 154.52ms - 157.37ms - unsure 🔍
-2% - +1%
-2.60ms - +1.15ms
branch 454 kB 155.45ms - 157.89ms unsure 🔍
-1% - +2%
-1.15ms - +2.60ms
-

split-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 671 kB 2034.31ms - 2037.20ms - unsure 🔍
-0% - +0%
-2.69ms - +2.10ms
branch 671 kB 2034.14ms - 2037.96ms unsure 🔍
-0% - +0%
-2.10ms - +2.69ms
-

swatch permalink

Version Bytes Avg Time vs remote vs branch
npm latest 389 kB 39.77ms - 40.25ms - unsure 🔍
-1% - +1%
-0.50ms - +0.23ms
branch 391 kB 39.87ms - 40.42ms unsure 🔍
-1% - +1%
-0.23ms - +0.50ms
-

switch permalink

Version Bytes Avg Time vs remote vs branch
npm latest 370 kB 46.43ms - 46.76ms - unsure 🔍
-1% - +0%
-0.56ms - +0.01ms
branch 372 kB 46.64ms - 47.10ms unsure 🔍
-0% - +1%
-0.01ms - +0.56ms
-

table permalink

Version Bytes Avg Time vs remote vs branch
npm latest 499 kB 500.21ms - 505.89ms - unsure 🔍
-1% - +0%
-6.66ms - +1.15ms
branch 501 kB 503.12ms - 508.49ms unsure 🔍
-0% - +1%
-1.15ms - +6.66ms
-

tabs permalink

Version Bytes Avg Time vs remote vs branch
npm latest 406 kB 169.21ms - 171.18ms - unsure 🔍
-1% - +1%
-1.21ms - +1.46ms
branch 408 kB 169.17ms - 170.97ms unsure 🔍
-1% - +1%
-1.46ms - +1.21ms
-

tags permalink

Version Bytes Avg Time vs remote vs branch
npm latest 451 kB 28.64ms - 28.90ms - faster ✔
0% - 1%
0.00ms - 0.36ms
branch 453 kB 28.83ms - 29.08ms slower ❌
0% - 1%
0.00ms - 0.36ms
-

textfield permalink

Version Bytes Avg Time vs remote vs branch
npm latest 417 kB 66.66ms - 67.48ms - unsure 🔍
-1% - +0%
-0.94ms - +0.26ms
branch 417 kB 66.97ms - 67.84ms unsure 🔍
-0% - +1%
-0.26ms - +0.94ms
-

toast permalink

Version Bytes Avg Time vs remote vs branch
npm latest 419 kB 45.10ms - 45.77ms - faster ✔
0% - 2%
0.14ms - 1.01ms
branch 421 kB 45.73ms - 46.29ms slower ❌
0% - 2%
0.14ms - 1.01ms
-

tooltip permalink

Version Bytes Avg Time vs remote vs branch
npm latest 360 kB 35.41ms - 35.65ms - faster ✔
1% - 2%
0.21ms - 0.71ms
branch 362 kB 35.78ms - 36.21ms slower ❌
1% - 2%
0.21ms - 0.71ms
-

top-nav permalink

Version Bytes Avg Time vs remote vs branch
npm latest 410 kB 122.50ms - 124.89ms - unsure 🔍
-1% - +1%
-1.61ms - +1.51ms
branch 412 kB 122.73ms - 124.75ms unsure 🔍
-1% - +1%
-1.51ms - +1.61ms
-

tray permalink

Version Bytes Avg Time vs remote vs branch
npm latest 444 kB 89.73ms - 90.50ms - unsure 🔍
-2% - +0%
-1.92ms - +0.07ms
branch 446 kB 90.12ms - 91.96ms unsure 🔍
-0% - +2%
-0.07ms - +1.92ms
-
Firefox

accordion permalink

Version Bytes Avg Time vs remote vs branch
npm latest 396 kB 518.80ms - 549.92ms - unsure 🔍
-4% - +4%
-20.94ms - +19.70ms
branch 398 kB 521.91ms - 548.05ms unsure 🔍
-4% - +4%
-19.70ms - +20.94ms
-

action-bar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 369 kB 140.66ms - 149.70ms - faster ✔
58% - 62%
200.29ms - 233.83ms
branch 471 kB 346.09ms - 378.39ms slower ❌
136% - 163%
200.29ms - 233.83ms
-

action-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 509 kB 487.62ms - 518.34ms - faster ✔
0% - 8%
0.24ms - 44.68ms
branch 512 kB 509.38ms - 541.50ms unsure 🔍
-0% - +9%
+0.24ms - +44.68ms
-

action-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 529 kB 329.16ms - 354.80ms - unsure 🔍
-7% - +2%
-23.05ms - +8.45ms
branch 532 kB 340.13ms - 358.43ms unsure 🔍
-3% - +7%
-8.45ms - +23.05ms
-

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 739 kB 400.68ms - 423.48ms - unsure 🔍
-3% - +6%
-13.64ms - +24.48ms
branch 740 kB 391.39ms - 421.93ms unsure 🔍
-6% - +3%
-24.48ms - +13.64ms
-

avatar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 382 kB 114.51ms - 125.57ms - unsure 🔍
-5% - +9%
-5.73ms - +10.85ms
branch 384 kB 111.31ms - 123.65ms unsure 🔍
-9% - +5%
-10.85ms - +5.73ms
-

badge permalink

Version Bytes Avg Time vs remote vs branch
npm latest 378 kB 144.21ms - 167.31ms - unsure 🔍
-14% - +7%
-23.39ms - +12.07ms
branch 380 kB 147.96ms - 174.88ms unsure 🔍
-8% - +15%
-12.07ms - +23.39ms
-

button-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 425 kB 303.12ms - 321.28ms - unsure 🔍
-5% - +3%
-17.17ms - +9.21ms
branch 426 kB 306.61ms - 325.75ms unsure 🔍
-3% - +6%
-9.21ms - +17.17ms
-

button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 430 kB 323.43ms - 351.81ms - unsure 🔍
-6% - +5%
-20.94ms - +16.14ms
branch 432 kB 328.09ms - 351.95ms unsure 🔍
-5% - +6%
-16.14ms - +20.94ms
-

card permalink

Version Bytes Avg Time vs remote vs branch
npm latest 492 kB 266.08ms - 291.96ms - unsure 🔍
-5% - +7%
-13.11ms - +18.23ms
branch 494 kB 267.63ms - 285.29ms unsure 🔍
-6% - +5%
-18.23ms - +13.11ms
-

checkbox permalink

Version Bytes Avg Time vs remote vs branch
npm latest 406 kB 215.04ms - 235.52ms - unsure 🔍
-8% - +5%
-19.64ms - +10.80ms
branch 408 kB 218.44ms - 240.96ms unsure 🔍
-5% - +9%
-10.80ms - +19.64ms
-

color-slider permalink

Version Bytes Avg Time vs remote vs branch
npm latest 439 kB 375.08ms - 395.28ms - unsure 🔍
-6% - +3%
-24.37ms - +10.89ms
branch 440 kB 377.47ms - 406.37ms unsure 🔍
-3% - +6%
-10.89ms - +24.37ms
-

color-wheel permalink

Version Bytes Avg Time vs remote vs branch
npm latest 440 kB 338.99ms - 355.61ms - faster ✔
8% - 14%
28.41ms - 55.59ms
branch 442 kB 378.55ms - 400.05ms slower ❌
8% - 16%
28.41ms - 55.59ms
-

dialog permalink

Version Bytes Avg Time vs remote vs branch
npm latest 432 kB 162.47ms - 181.77ms - unsure 🔍
-8% - +9%
-13.16ms - +14.96ms
branch 434 kB 160.99ms - 181.45ms unsure 🔍
-9% - +8%
-14.96ms - +13.16ms
-

field-label permalink

Version Bytes Avg Time vs remote vs branch
npm latest 373 kB 133.39ms - 150.41ms - unsure 🔍
-10% - +8%
-14.01ms - +12.17ms
branch 375 kB 132.88ms - 152.76ms unsure 🔍
-9% - +10%
-12.17ms - +14.01ms
-

link permalink

Version Bytes Avg Time vs remote vs branch
npm latest 367 kB 87.10ms - 99.02ms - unsure 🔍
-12% - +6%
-11.54ms - +6.06ms
branch 369 kB 89.33ms - 102.27ms unsure 🔍
-7% - +13%
-6.06ms - +11.54ms
-

menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 420 kB 536.91ms - 572.85ms - unsure 🔍
-1% - +8%
-3.85ms - +41.21ms
branch 422 kB 522.60ms - 549.80ms unsure 🔍
-7% - +1%
-41.21ms - +3.85ms
-

meter permalink

Version Bytes Avg Time vs remote vs branch
npm latest 388 kB 213.05ms - 234.27ms - unsure 🔍
-8% - +5%
-17.08ms - +12.08ms
branch 390 kB 216.16ms - 236.16ms unsure 🔍
-5% - +8%
-12.08ms - +17.08ms
-

number-field permalink

Version Bytes Avg Time vs remote vs branch
npm latest 626 kB 451.57ms - 482.67ms - faster ✔
4% - 13%
20.57ms - 65.91ms
branch 628 kB 493.87ms - 526.85ms slower ❌
4% - 14%
20.57ms - 65.91ms
-

overlay permalink

Version Bytes Avg Time vs remote vs branch
npm latest 457 kB 173.66ms - 195.86ms - unsure 🔍
-7% - +10%
-12.30ms - +18.86ms
branch 458 kB 170.55ms - 192.41ms unsure 🔍
-10% - +7%
-18.86ms - +12.30ms
-

picker permalink

Version Bytes Avg Time vs remote vs branch
npm latest 593 kB 1036.69ms - 1074.95ms - unsure 🔍
-2% - +3%
-20.93ms - +31.65ms
branch 594 kB 1032.43ms - 1068.49ms unsure 🔍
-3% - +2%
-31.65ms - +20.93ms
-

popover permalink

Version Bytes Avg Time vs remote vs branch
npm latest 366 kB 113.59ms - 128.89ms - unsure 🔍
-11% - +6%
-13.87ms - +7.51ms
branch 368 kB 116.95ms - 131.89ms unsure 🔍
-6% - +12%
-7.51ms - +13.87ms
-

progress-bar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 385 kB 149.39ms - 169.13ms - faster ✔
5% - 21%
8.70ms - 40.38ms
branch 391 kB 171.41ms - 196.19ms slower ❌
5% - 26%
8.70ms - 40.38ms
-

progress-circle permalink

Version Bytes Avg Time vs remote vs branch
npm latest 365 kB 217.73ms - 244.11ms - unsure 🔍
-8% - +7%
-17.79ms - +16.99ms
branch 367 kB 219.98ms - 242.66ms unsure 🔍
-7% - +8%
-16.99ms - +17.79ms
-

radio permalink

Version Bytes Avg Time vs remote vs branch
npm latest 391 kB 288.52ms - 311.56ms - unsure 🔍
-5% - +5%
-15.75ms - +14.79ms
branch 393 kB 290.50ms - 310.54ms unsure 🔍
-5% - +5%
-14.79ms - +15.75ms
-

search permalink

Version Bytes Avg Time vs remote vs branch
npm latest 469 kB 220.72ms - 242.52ms - unsure 🔍
-12% - +1%
-28.72ms - +1.76ms
branch 470 kB 234.44ms - 255.76ms unsure 🔍
-1% - +13%
-1.76ms - +28.72ms
-

sidenav permalink

Version Bytes Avg Time vs remote vs branch
npm latest 394 kB 897.11ms - 926.61ms - unsure 🔍
-3% - +2%
-28.37ms - +14.09ms
branch 396 kB 903.73ms - 934.27ms unsure 🔍
-2% - +3%
-14.09ms - +28.37ms
-

slider permalink

Version Bytes Avg Time vs remote vs branch
npm latest 452 kB 357.53ms - 385.87ms - unsure 🔍
-5% - +4%
-19.75ms - +14.39ms
branch 454 kB 364.85ms - 383.91ms unsure 🔍
-4% - +5%
-14.39ms - +19.75ms
-

split-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 671 kB 2157.59ms - 2177.17ms - unsure 🔍
-0% - +1%
-6.30ms - +15.58ms
branch 671 kB 2157.85ms - 2167.63ms unsure 🔍
-1% - +0%
-15.58ms - +6.30ms
-

swatch permalink

Version Bytes Avg Time vs remote vs branch
npm latest 389 kB 126.47ms - 143.85ms - unsure 🔍
-9% - +10%
-12.05ms - +13.77ms
branch 391 kB 124.75ms - 143.85ms unsure 🔍
-10% - +9%
-13.77ms - +12.05ms
-

switch permalink

Version Bytes Avg Time vs remote vs branch
npm latest 370 kB 122.72ms - 140.72ms - unsure 🔍
-9% - +9%
-11.44ms - +11.76ms
branch 372 kB 124.24ms - 138.88ms unsure 🔍
-9% - +9%
-11.76ms - +11.44ms
-

table permalink

Version Bytes Avg Time vs remote vs branch
npm latest 499 kB 1143.54ms - 1177.06ms - faster ✔
7% - 10%
86.88ms - 125.24ms
branch 501 kB 1257.03ms - 1275.69ms slower ❌
7% - 11%
86.88ms - 125.24ms
-

tabs permalink

Version Bytes Avg Time vs remote vs branch
npm latest 406 kB 334.30ms - 362.18ms - unsure 🔍
-3% - +7%
-11.55ms - +22.55ms
branch 408 kB 332.92ms - 352.56ms unsure 🔍
-6% - +3%
-22.55ms - +11.55ms
-

tags permalink

Version Bytes Avg Time vs remote vs branch
npm latest 451 kB 76.89ms - 92.31ms - unsure 🔍
-15% - +9%
-13.04ms - +7.60ms
branch 453 kB 80.45ms - 94.19ms unsure 🔍
-9% - +16%
-7.60ms - +13.04ms
-

textfield permalink

Version Bytes Avg Time vs remote vs branch
npm latest 417 kB 140.02ms - 160.38ms - unsure 🔍
-14% - +6%
-21.48ms - +10.32ms
branch 417 kB 143.57ms - 167.99ms unsure 🔍
-7% - +14%
-10.32ms - +21.48ms
-

toast permalink

Version Bytes Avg Time vs remote vs branch
npm latest 419 kB 132.03ms - 154.29ms - unsure 🔍
-8% - +14%
-10.56ms - +19.44ms
branch 421 kB 128.67ms - 148.77ms unsure 🔍
-13% - +7%
-19.44ms - +10.56ms
-

tooltip permalink

Version Bytes Avg Time vs remote vs branch
npm latest 360 kB 90.01ms - 103.99ms - unsure 🔍
-18% - +8%
-19.30ms - +9.14ms
branch 362 kB 89.69ms - 114.47ms unsure 🔍
-10% - +20%
-9.14ms - +19.30ms
-

top-nav permalink

Version Bytes Avg Time vs remote vs branch
npm latest 410 kB 243.91ms - 266.73ms - unsure 🔍
-8% - +5%
-21.72ms - +13.36ms
branch 412 kB 246.18ms - 272.82ms unsure 🔍
-5% - +9%
-13.36ms - +21.72ms
-

tray permalink

Version Bytes Avg Time vs remote vs branch
npm latest 444 kB 239.39ms - 261.97ms - unsure 🔍
-7% - +4%
-18.68ms - +10.88ms
branch 446 kB 245.04ms - 264.12ms unsure 🔍
-4% - +8%
-10.88ms - +18.68ms
-

@Westbrook Westbrook changed the title Issue(3146)-Use innerText when label is not provided (meter, progress-bar, progress-circle) fix(meter, progress-bar, progress-circle): use innerText when label is not provided Jul 21, 2023
Copy link
Collaborator

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made notes on ProgressCircle, but it looks like they apply to all three elements.

Also, this changes the reality of the Dev Mode warnings in the Progress* elements. Please review, update or remove, and if the message persists see if it is worth adopting in Meter.

packages/progress-circle/src/ProgressCircle.ts Outdated Show resolved Hide resolved
packages/progress-circle/src/ProgressCircle.ts Outdated Show resolved Hide resolved
packages/progress-circle/src/ProgressCircle.ts Outdated Show resolved Hide resolved
validSizes: ['s', 'm', 'l'],
}) {
export class ProgressCircle extends SizedMixin(
ObserveSlotText(SpectrumElement, ''),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that Progress Circle doesn't show the label visibly, it might not need this feature addition. It's not "free" from a performance standpoint, so we should be sure that it is 100% needed.

Progress Bar may need it, as the label is visible there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what could be the other way of allowing the innerText to act as a label in case label is not provided without using a slot?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObserveSlotText will only let you know if there is text there or not in a reactive way. You do much the same in getLabelFromSlot right now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👆🏼

@TarunAdobe TarunAdobe requested a review from Rajdeepc July 24, 2023 08:23
tools/shared/src/get-label-from-slot.ts Outdated Show resolved Hide resolved
tools/shared/src/get-label-from-slot.ts Outdated Show resolved Hide resolved
packages/progress-circle/src/ProgressCircle.ts Outdated Show resolved Hide resolved
packages/progress-circle/src/ProgressCircle.ts Outdated Show resolved Hide resolved
packages/meter/src/Meter.ts Outdated Show resolved Hide resolved
packages/progress-bar/src/ProgressBar.ts Show resolved Hide resolved
@TarunAdobe TarunAdobe requested a review from Rajdeepc July 24, 2023 13:53
@Rajdeepc
Copy link
Contributor

Rajdeepc commented Jul 24, 2023

@TarunAdobe If you see some build failing on one test suite. Please re run the workflow. It should pass eventually.

packages/progress-circle/src/ProgressCircle.ts Outdated Show resolved Hide resolved
@@ -83,6 +90,17 @@ export class Meter extends SizedMixin(ObserveSlotText(SpectrumElement, '')) {
`;
}

protected onSlotChange(): void {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
protected onSlotChange(): void {
protected handleSlotchange(): void {

Across the board here, 🙏🏼.

This method being used in each of three components points to this possibly benefiting a Reactive Controller or mixin for reusability. Let's not worry about that today, but keep an eye out for this pattern in case we end up using it again somewhere else.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝🏼

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using onSlotChange naming convention in multiple components already.... so this feels more consistent. for instance checkout -> ActiveOverlay.ts, Tabs.ts and TopNav.ts

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for digging in on normalization! That's a great trait, and something we should do more of as a project. However, we have not normalized here very well, see handleSlotchange usage... 😞

on* is a common practice in frameworks like React, and surfacing methods on our custom elements with a similar name can cause issues when working in that context without a wrapping React Component. We see this locally in our Storybook from time to time, and while we've recently started shipping React Wrappers to reduce the changes this happens for our consumers that leverage React, at some point in the future React will finally ship framework native support for custom events and setting properties on DOM elements and users will be freed to return to direct consumption of SWC in that context, so we want to be prepared for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright got it. I'll change it then

packages/progress-circle/src/ProgressCircle.ts Outdated Show resolved Hide resolved
'https://opensource.adobe.com/spectrum-web-components/components/progress-circle/#accessibility',
{
type: 'accessibility',
issues: [
'value supplied to the "label" attribute, which will be displayed visually as part of the element, or',
'value supplied to the "aria-label" attribute, which will only be provided to screen readers, or',
'if the value is not supplied to "label" attribute and the "content" is also not set for the component, or',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'if the value is not supplied to "label" attribute and the "content" is also not set for the component, or',
'value supplied to the "label" attribute, which will be displayed visually as part of the element, or',
'text content supplied directly to the <sp-progress-circle> element, or',
'value supplied to the "aria-label" attribute, which will only be provided to screen readers, or',

Co-authored-by: Westbrook Johnson <wesjohns@adobe.com>
Rajdeepc
Rajdeepc previously approved these changes Jul 26, 2023
@Rajdeepc Rajdeepc added the in-review Label to trigger PR auto Update from main label Jul 26, 2023
Copy link
Collaborator

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -83,6 +90,17 @@ export class Meter extends SizedMixin(ObserveSlotText(SpectrumElement, '')) {
`;
}

protected onSlotChange(): void {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝🏼

validSizes: ['s', 'm', 'l'],
}) {
export class ProgressCircle extends SizedMixin(
ObserveSlotText(SpectrumElement, ''),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👆🏼

Rajdeepc
Rajdeepc previously approved these changes Jul 27, 2023
Copy link
Collaborator

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have been more clear about this last point. Let me know if I can explain any of my goals there in a different way for you.

One last thing and it ships!

protected override firstUpdated(changes: PropertyValues): void {
super.firstUpdated(changes);
if (!this.hasAttribute('role')) {
this.setAttribute('role', 'progressbar');
}
this.slotHasContent = this.slotEl.assignedNodes().length > 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the work that I was attempting to do in a lazy manner by removing the ObserveSlotText mixin from this class. Below in getLabelFromSlot you already do a check for this, so if you were to remove slotHasContent from the method signature there you would be able to do less work in this element unless it was needed, as signified by the lack of a label.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so should I remove the slotHasContent all together from the method itself?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the functionality continues as expected without it, yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So Im running into a small issue here... If I remove the slotHasContent Attribute then in the dev warnings the condition to give warning would be true if the label is not there. So let's say someone has provided some content in the slot but still that condition would be true for the first render call and then it would be false as the label would get updated from the slot content. But this also means the warning would still be there in console from the first call. That is why I added this variable to check if the slot has content then we don't show the warning even if the label is not there bcz we know eventually label would be updated with the slot content once the onSlotChange method is completed!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super helpful delineation!

ObserveSlotText will always do some work, whether you have content or not, have a label or not, have Dev Mode or not...

Any work within if (window.__swc.DEBUG) { ... } will only happen when Dev Mode is on. So if we replace !this.slotHasContent in line 154 with !this.slotEl.assignedNodes().length we'd only require using in that context to do that work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it... I'll fix it and make a commit now... Thank you so much for clarifying

Copy link
Collaborator

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Thanks for working through all the nuance on this. 👏🏼 👏🏼 👏🏼

@Westbrook Westbrook merged commit 59358c7 into main Jul 27, 2023
47 checks passed
@Westbrook Westbrook deleted the issue/3146-meter-progress-aria-label branch July 27, 2023 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in-review Label to trigger PR auto Update from main
Projects
None yet
3 participants