Skip to content

feat: Allow button-dropdown native attributes to be set #3554

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gethinwebster
Copy link
Member

@gethinwebster gethinwebster commented Jun 4, 2025

Description

Allow button native attributes to be set.

Related links, issue #, if available: AWSUI-60864

How has this been tested?

New unit tests

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

codecov bot commented Jun 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.54%. Comparing base (4fcfe74) to head (1b79f4b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3554      +/-   ##
==========================================
- Coverage   96.55%   96.54%   -0.01%     
==========================================
  Files         804      804              
  Lines       23439    23440       +1     
  Branches     8167     8178      +11     
==========================================
  Hits        22631    22631              
+ Misses        801      755      -46     
- Partials        7       54      +47     

☔ 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.

@gethinwebster gethinwebster marked this pull request as ready for review June 4, 2025 09:07
@gethinwebster gethinwebster requested a review from a team as a code owner June 4, 2025 09:07
@gethinwebster gethinwebster requested review from pan-kot and removed request for a team June 4, 2025 09:07
/**
* Attributes to add to the native `button` element.
*
* It is not supported to use this attribute to apply custom styling.
Copy link
Member

Choose a reason for hiding this comment

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

What does "not supported" actually mean? Technically, style property can still be used.

Copy link
Member Author

Choose a reason for hiding this comment

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

it means we don't provide any promises that it will not break in the future if you use it for styling.

Copy link
Member

Choose a reason for hiding this comment

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

Should we say something like: "Do not use this property to provide custom inline styles to the component"?

pan-kot

This comment was marked as duplicate.

@@ -326,6 +322,7 @@ export const InternalButton = React.forwardRef(
disabled={disabled && !__focusable && !isDisabledWithReason}
aria-disabled={hasAriaDisabled ? true : undefined}
{...disabledReasonProps}
{...nativeAttributes}
Copy link
Member

Choose a reason for hiding this comment

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

This can technically override the button class names, and there is no ability to access the button's assigned classnames from the outside. Should we either exclude className from the native attributes type, or make sure the class name that comes from native attributes is merged with the one we define using clsx?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants