Skip to content

refactor: Refactors token to use internal button for dismiss - #5189

Merged
pan-kot merged 2 commits into
mainfrom
refactor-token-dismiss
Oct 28, 2026
Merged

pan-kot merged 2 commits into
mainfrom
refactor-token-dismiss

Conversation

@pan-kot

@pan-kot pan-kot commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Description

Makes token component use internal button instead of a custom dismiss button implementation. The change is done in preparation of adding styling v2 support: it is not a requirement, but it helps to make styling implementation simpler.

How has this been tested?

  • Manual testing
  • Existing visual regression 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.

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.73%. Comparing base (e82bbc0) to head (cb073e6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5189      +/-   ##
==========================================
- Coverage   97.73%   97.73%   -0.01%     
==========================================
  Files         998      998              
  Lines       32291    32287       -4     
  Branches    11941    11939       -2     
==========================================
- Hits        31561    31557       -4     
+ Misses        724      685      -39     
- Partials        6       45      +39     

☔ View full report in Codecov by Harness.
📢 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.

@pan-kot
pan-kot marked this pull request as ready for review October 27, 2026 08:56
@pan-kot
pan-kot requested a review from a team as a code owner October 27, 2026 08:56
@pan-kot
pan-kot requested review from NathanZlion and a balanced review from Copilot and removed request for a team October 27, 2026 08:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The refactor changes pressed-state dismiss colors for unstyled and partially styled tokens.

1 open issue
What changed in this PR

Refactors token dismissal to use the shared internal button, reducing custom implementation ahead of styling v2 support.

Changes:

  • Replaces the custom dismiss button with InternalButton.
  • Maps token dismiss styles to button styles and isolates inherited styling properties.
  • Updates style, motion, and analytics tests for the shared implementation.
File Description
src/​token/​styles.tsx Maps dismiss styles to the button style API.
src/​token/​styles.scss Preserves token-specific button geometry and focus styling.
src/​token/​internal.tsx Passes token styles to the dismiss button.
src/​token/​dismiss-button.tsx Replaces custom markup with InternalButton.
src/​token/​__tests__/​token.test.tsx Updates motion attribute expectations.
src/​token/​__tests__/​styles.test.tsx Tests dismiss style mapping and state precedence.
src/​token/​__tests__/​analytics-metadata.test.tsx Checks exact dismiss analytics metadata.
src/​token/​__tests__/​__snapshots__/​styles.test.tsx.snap Removes dismiss styles from root snapshots.
src/​internal/​styles/​forms/​mixins.scss Adds a reset for inherited button styling properties.

Review effort: Balanced

Comment thread src/token/styles.scss
#{custom-props.$styleFocusRingBoxShadow}: 0 0 0
var(#{custom-props.$styleFocusRingBorderWidth}, foundation.$box-shadow-focused-width)
var(#{custom-props.$styleFocusRingBorderColor}, awsui.$color-border-item-focused);
@include styles.reset-v1-button-styles;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good comment. The new behaviour is indeed different from the previous custom dismiss button implementation. At the same time - it is consistent with icon button's default implementation - so also reproducible in standalone buttons or e.g. in Alert/Flashbar dismiss. I believe we should keep it therefore for consistency, and if we want a design change - apply it for all icon buttons, not just token dismiss.

@pan-kot
pan-kot added this pull request to the merge queue Oct 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 28, 2026
@pan-kot
pan-kot added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 2f15b03 Oct 28, 2026
68 checks passed
@pan-kot
pan-kot deleted the refactor-token-dismiss branch October 28, 2026 16:01

This branch was successfully deployed

3 active deployments
dev-pages-react16 — cb073e69 Deployed Oct 28, 2026 by pan-kot via deploy (React 16) / deploy #3010
dev-pages-react18 — cb073e69 Deployed Oct 28, 2026 by pan-kot via deploy (React 18) / deploy #3010
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.

3 participants