Skip to content

Conversation

@r1shabhsharma
Copy link
Contributor

Closes #20042

This PR includes:

  • Adding ariaLabel field for button component
  • Defining button labels for pagination component
  • Defining ariaLabel field for select component

Before:
Screenshot 2025-07-30 at 2 54 40 PM

Screenshot 2025-07-30 at 2 54 53 PM

After:

Screenshot 2025-07-30 at 3 04 24 PM Screenshot 2025-07-30 at 3 04 35 PM

Changelog

New

  • {{new thing}}

Changed

  • {{changed thing}}

Removed

  • {{removed thing}}

Testing / Reviewing

{{ Add steps or a checklist for how reviewers can verify this PR works or not }}

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@r1shabhsharma r1shabhsharma requested a review from a team as a code owner July 30, 2025 09:35
@r1shabhsharma r1shabhsharma requested review from a team, heloiselui and tay1orjones July 30, 2025 09:35
@r1shabhsharma
Copy link
Contributor Author

The default texts mentioned for the ariaLabel input is referred from carbon-components-angular repo. Not sure if we support key translations here

@netlify
Copy link

netlify bot commented Jul 30, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit ae0e1b2
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/68c7a2b48bf7500008906c6c
😎 Deploy Preview https://deploy-preview-20043--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jul 30, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit ae0e1b2
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/68c7a2b4ee1a15000834d750
😎 Deploy Preview https://deploy-preview-20043--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jul 30, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ae0e1b2
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/68c7a2b47d27b400086d3a56
😎 Deploy Preview https://deploy-preview-20043--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Jul 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.03%. Comparing base (30b4f87) to head (ae0e1b2).
⚠️ Report is 422 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (30b4f87) and HEAD (ae0e1b2). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (30b4f87) HEAD (ae0e1b2)
web-components 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20043      +/-   ##
==========================================
- Coverage   91.39%   85.03%   -6.36%     
==========================================
  Files         485      355     -130     
  Lines       31370    14393   -16977     
  Branches     5430     4819     -611     
==========================================
- Hits        28670    12239   -16431     
+ Misses       2547     2014     -533     
+ Partials      153      140      -13     
Flag Coverage Δ
main-packages 85.03% <ø> (+0.09%) ⬆️
web-components ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@heloiselui heloiselui left a comment

Choose a reason for hiding this comment

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

LGTM, just need to resolve the conflicts and you may need to update the tests for these components. Thanks for your help!

?disabled="${prevButtonDisabled}"
button-class-name="${prevButtonClasses}"
tooltip-text="${backwardText}"
aria-label="Backward"
Copy link
Member

Choose a reason for hiding this comment

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

Why not use the backwardText?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both the review comments are addressed

?disabled="${nextButtonDisabled}"
button-class-name="${nextButtonClasses}"
tooltip-text="${forwardText}"
aria-label="Forward"
Copy link
Member

Choose a reason for hiding this comment

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

Same here, why not forwardText?

@heloiselui
Copy link
Contributor

@r1shabhsharma if you need any help, just let us know!

@r1shabhsharma
Copy link
Contributor Author

r1shabhsharma commented Sep 10, 2025

@heloiselui Sure, Thanks!
I have added the fix as per review comments
Which tests are we talking about? Could not see any unit tests for the same...
Nvm, found the error in UTs

@r1shabhsharma
Copy link
Contributor Author

Can we merge this PR? Or get some reviews please?
It has been open for a while now
@Gururajj77 @emyarod @heloiselui @tay1orjones

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

Sorry, I think this fell of radar because CI is failing and there is a minor conflict that needs resolved. Also a couple comments

* Specify text for the accessibility label of the button
*/
@property({ attribute: 'aria-label' })
ariaLabel = '';
Copy link
Member

Choose a reason for hiding this comment

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

This should be undefined by default I think, rather than an empty string. This is why it's being included in the snapshot when I don't think it should be.

Suggested change
ariaLabel = '';
ariaLabel!: string;

?disabled="${disabled}"
aria-readonly="${String(Boolean(readonly))}"
aria-invalid="${String(Boolean(invalid))}"
aria-label=${ifDefined(ariaLabel)}
Copy link
Member

Choose a reason for hiding this comment

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

I think the way to fix this isn't through an aria-label, but refactoring the hideLabel logic down on L498.

In the react version, Select always has a label. hideLabel toggles a class to visibly hide the label, not completely omit it from the dom like the web components one does here. I think this would fix most/all situations where you'd reach for an aria-label and would make it more accessible out of the box.

@heloiselui
Copy link
Contributor

Hey, we’re closing this PR in favor of this one: #21051. Thanks a lot for your contribution!

@heloiselui heloiselui closed this Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[a11y]: Form control element has no associated label

4 participants