Skip to content

fix: Support icons for button dropdown groups#3710

Merged
mariksav merged 24 commits intomainfrom
fix/icon-for-button-dropdown
Aug 5, 2025
Merged

fix: Support icons for button dropdown groups#3710
mariksav merged 24 commits intomainfrom
fix/icon-for-button-dropdown

Conversation

@mariksav
Copy link
Contributor

@mariksav mariksav commented Aug 1, 2025

Description

Fix for #3684

Customers want to assign icons to expandable ButtonDropdowns, which wasn't possible so far. In order to enable that functionality, the rendering for icons for expandable Dropdown Buttons was added and test cases implemented. Furthermore, the style was changed to keep the look of the page consistent.

Issue: AWSUI-60667

How has this been tested?
Tested locally with unit and integration tests.
Ran through own pipeline.

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

@codecov
Copy link

codecov bot commented Aug 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.00%. Comparing base (1250d57) to head (67222cd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3710    +/-   ##
========================================
  Coverage   97.00%   97.00%            
========================================
  Files         821      821            
  Lines       23856    23862     +6     
  Branches     8377     7953   -424     
========================================
+ Hits        23141    23147     +6     
- Misses        666      709    +43     
+ Partials       49        6    -43     

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

@mariksav mariksav marked this pull request as ready for review August 1, 2025 08:09
@mariksav mariksav requested a review from a team as a code owner August 1, 2025 08:09
@mariksav mariksav requested review from avinashbot and removed request for a team August 1, 2025 08:09
Copy link
Member

@avinashbot avinashbot left a comment

Choose a reason for hiding this comment

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

Also a general comment to update the PR title to be more friendly - they show up in the release notes!

{item.text && (
<p className={clsx(styles.header, { [styles.disabled]: disabled })} aria-hidden="true">
{item.text}
<span style={{ display: 'flex', alignItems: 'center' }}>
Copy link
Member

Choose a reason for hiding this comment

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

Inline styles here - best to avoid them unless necessary for things like dynamic calculations. Inline styles don't match our Content-Security-Policy recommendations.

Copy link
Member

Choose a reason for hiding this comment

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

Also, out of curiosity, since you have align-items: center on the .header anyway, why have another wrapper span? (Maybe there are good reasons, just curious)

Copy link
Contributor Author

@mariksav mariksav Aug 1, 2025

Choose a reason for hiding this comment

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

Good point! I used it during the troubleshooting after the rollback when align-items: center wasn't in the header yet, but it might not be necessary any more. I'm going to test it and remove it if possible.

margin-block-end: -1px;
}

.icon-wrapper {
Copy link
Member

Choose a reason for hiding this comment

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

If the parent is going to be a display: flex, I think you could just put gap: awsui.$space-xxs on the parent and not have to deal with a wrapper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that was the same idea that I had as well, but it caused the caret to be misplaced in button-dropdown/disabled-reason. So I circumvented that issue with the wrapper

@mariksav mariksav changed the title fix: icon for button dropdown fix: Support icons for button dropdown groups Aug 1, 2025
@mariksav
Copy link
Contributor Author

mariksav commented Aug 4, 2025

I removed the span wrapper and everything works fine.

avinashbot
avinashbot previously approved these changes Aug 4, 2025
@mariksav
Copy link
Contributor Author

mariksav commented Aug 5, 2025

I retested the change and saw that the span wrapper was actually necessary, because otherwise the website formats in an unpleasant way in a few cases. So I will need to readd it, but I removed the inline styling. Please let me know what you think

Copy link
Member

@avinashbot avinashbot left a comment

Choose a reason for hiding this comment

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

Okay, a few extra divs/spans is no big deal - not going to block a merge just to spend time diving into a weird flex situation lol

@mariksav mariksav added this pull request to the merge queue Aug 5, 2025
Merged via the queue into main with commit eb48d66 Aug 5, 2025
38 checks passed
@mariksav mariksav deleted the fix/icon-for-button-dropdown branch August 5, 2025 16:22
@mariksav mariksav restored the fix/icon-for-button-dropdown branch August 7, 2025 08:50
pranshuteotia pushed a commit to pranshuteotia/components that referenced this pull request Sep 3, 2025
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