Skip to content

feat(icon): align component with fusion DS - FE-7171#7910

Merged
DipperTheDan merged 2 commits into
masterfrom
FE-7171-icon-ds-audit-updates
May 29, 2026
Merged

feat(icon): align component with fusion DS - FE-7171#7910
DipperTheDan merged 2 commits into
masterfrom
FE-7171-icon-ds-audit-updates

Conversation

@DipperTheDan

Copy link
Copy Markdown
Contributor

Proposed behaviour

Align component with current Fusion DS

Current behaviour

Component is currently not aligned with Fusion DS

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

N/A

Testing instructions

N/A

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aligns the Icon component (and dependent tooltip usage across the library) with the current Fusion Design System by removing legacy, internally-rendered icon tooltips, introducing token-based icon colours (including an inverse mode), and updating consuming components/tests/docs to use the dedicated Tooltip component.

Changes:

  • Remove internal tooltip rendering from Icon and deprecate legacy tooltip-related props (now no-op with warnings).
  • Introduce size/inverse behaviour and update icon colour usage to DS tokens; refresh stories/docs accordingly.
  • Update components that previously relied on Icon tooltips (e.g. Help, Button, ValidationIcon) to wrap Icon with Tooltip, and prune/update Playwright/unit tests.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/components/switch/switch.pw.tsx Removes tooltip placement prop-test coverage for Switch help tooltip.
src/components/select/simple-select/simple-select.pw.tsx Removes tooltip placement prop-test coverage for SimpleSelect help tooltip.
src/components/select/multi-select/multi-select.pw.tsx Removes labelHelp special-char tooltip test + tooltip placement prop-test coverage.
src/components/select/filterable-select/filterable-select.pw.tsx Removes tooltip placement prop-test coverage for FilterableSelect help tooltip.
src/components/portrait/portrait.style.tsx Adjusts portrait’s styled icon sizing prop to avoid clashing with new Icon size.
src/components/portrait/portrait.component.tsx Updates Portrait to pass the new portrait sizing prop into the styled Icon wrapper.
src/components/numeral-date/numeral-date.pw.tsx Removes tooltip positioning prop-test coverage and unused Box import.
src/components/number/number.pw.tsx Removes tooltip positioning prop-test coverage and unused Box import.
src/components/menu/menu-full-screen/menu-full-screen.test.tsx Updates close icon colour expectations to DS token.
src/components/icon/icon.test.tsx Reworks tests to assert tooltip deprecation/no-render + adds inverse/interactive styling coverage.
src/components/icon/icon.style.ts Adds inverse token-based colour support and centralises selector overrides.
src/components/icon/icon.stories.tsx Updates stories to size/inverse, removes tooltip-focused stories, and adjusts icon list layout.
src/components/icon/icon.pw.tsx Removes tooltip-related Playwright coverage and simplifies component import.
src/components/icon/icon.mdx Updates docs to remove internal tooltip guidance; adds naming conventions and new examples.
src/components/icon/icon.component.tsx Removes internal tooltip rendering, introduces size, and adds deprecation warnings for legacy props.
src/components/icon/component.test-pw.tsx Removes the tooltip-specific PW component wrapper; simplifies to default export.
src/components/help/help.pw.tsx Deletes Help Playwright test suite (tooltip behaviour no longer driven by Icon).
src/components/help/help.component.tsx Replaces Icon-internal tooltip usage with explicit Tooltip wrapping.
src/components/duelling-picklist/duelling-picklist.pw.tsx Removes Picklist tooltip-related Playwright assertions that depended on legacy icon tooltip behaviour.
src/components/checkbox/checkbox.pw.tsx Removes tooltip positioning Playwright tests while retaining accessibility hover checks where applicable.
src/components/button/button.component.tsx Wraps button icons with Tooltip when iconTooltipMessage is provided (instead of Icon tooltips).
src/components/button-minor/button-minor.pw.tsx Removes tooltip-related Playwright assertions for icon-only-with-tooltip scenarios.
src/internal/validations/validation-icon.component.tsx Moves validation messaging to explicit Tooltip wrapper around Icon and respects tooltip context positioning.
src/internal/label/label.test.tsx Changes validation tooltip placement assertions to spy on ValidationIcon props rather than DOM tooltip placement.
skills/carbon-react/components/icon.md Updates icon “skills” docs to include new props and deprecation metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/icon/icon.style.ts Outdated
Comment thread src/components/icon/icon.style.ts
Comment thread src/components/portrait/portrait.style.tsx Outdated
@nuria1110 nuria1110 self-requested a review April 22, 2026 12:16

@nuria1110 nuria1110 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.

I think the icon-config file may also need to be updated as it seems to be using some had-coded pixel values and old design-tokens. I was also under the assumption that Icons were minimum 20px now, but I could be wrong, I can't seem to find any size information on the DS.

Comment thread src/components/icon/icon.component.tsx Outdated
Array.isArray(tooltipFlipOverrides) &&
tooltipFlipOverrides.every((override) =>
ICON_TOOLTIP_POSITIONS.includes(override),
if (fontSize && !deprecateFontSizeTriggered) {

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.

comment (non-blocking): We have quite a large number of deprecated props here, we could just rely on the IDE and docs to indicate deprecations, it would avoid having to add tests for the console warnings too.

Comment on lines +54 to +57
/**
* @deprecated Tooltip support has been removed from `Icon`. Use a dedicated `Tooltip`
* component wrapping the `Icon` instead. This prop no longer has any effect.
*/

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.

nit-pick: I think we could just say we discourage the use of Tooltips in general, since the Tooltip component has been deprecated we would not want to encourage consumers to use it either.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah the advice was if they really need a workaround for tooltips in the meantime, but I'm happy to follow your wording for discouragement.

Comment thread src/components/icon/icon.component.tsx Outdated
Comment on lines +40 to +43
extends Omit<
StyledIconProps,
"type" | "bg" | "bgShape" | "bgSize" | "color" | "disabled" | "fontSize"
>,

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.

suggestion: I think we could use Pick<> here instead of Omit<> to avoid props being accidentally added to the component's public interface.

Aware this is probably out of scope for this but just thought it was worth noting that instead of extending StyledIconProps, I think we should keep these interfaces separate and only define props intended for the public interface in IconProps, and StyledIconProps only contain props intended to be passed to the styled component internally.

@DipperTheDan DipperTheDan force-pushed the FE-7171-icon-ds-audit-updates branch 2 times, most recently from e171793 to ab7a7fd Compare April 23, 2026 15:38
@DipperTheDan DipperTheDan marked this pull request as ready for review April 29, 2026 12:42
@DipperTheDan DipperTheDan requested review from a team as code owners April 29, 2026 12:42
@DipperTheDan DipperTheDan marked this pull request as draft April 30, 2026 07:28
@DipperTheDan DipperTheDan marked this pull request as ready for review April 30, 2026 08:36
@DipperTheDan DipperTheDan marked this pull request as draft April 30, 2026 08:53

@DipperTheDan DipperTheDan May 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've added the margin-bottom to these examples as due to the slight increase in icon size, it looked like a column of 9 dots. To me, this makes it now look like three separate components and gives the focus border room to breathe.

nuria1110
nuria1110 previously approved these changes May 1, 2026
if (isInTab) {
return undefined;
const resolvedSize = useMemo((): "small" | "medium" | "large" => {
if (fontSize) {

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.

 if (fontSize === "extra-large") {
    Logger.warn(
      `[Icon] The \`fontSize\` value "extra-large" is no longer supported and has been mapped to "large".`,
    );
    return "large";
  }

return fontSize ?? size ?? "small";

you could even set a default value on size and remove small here if needed

tooltipMessage={validationMessage}
tooltipPosition={tooltipPosition}
tooltipVisible={
<Tooltip

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.

comment: Don't mind this approach as Tooltips falling off the legacy validation makes having the legacy validation pointless and we decided to remove piecemeal etc

tooltipMessage={iconTooltipMessage}
tooltipPosition={iconTooltipPosition}
/>
{iconTooltipMessage ? (

@edleeks87 edleeks87 May 7, 2026

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.

comment: I'm less keen on this but I think it's probably fine given it's the legacy button, but let's check with @harpalsingh as we might be able to just drop it as I doubt it's as critical as it is for the legacy validation etc

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.

question: are the accessibility tests no longer valid?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually they probably are valid. I went a bit wild here and thought we could get rid of a good chunk of Playwright tests. I'll get the accessibility stuff added back in where valid.

Comment thread src/components/icon/icon.test.tsx Outdated
});

test("renders a tooltip, populated with a custom value that is passed to the 'tooltipMessage' prop", async () => {
test("does not render the `tooltipMessage` prop value", () => {

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.

question: is there any coverage we'd lose without these tooltip test cases? Feels like they're false === false type tests etc so if we can I'd just remove

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll see if we can, any that we have to keep I'll comment with a coverage required comment.

Comment thread src/components/icon/icon.style.ts Outdated
display: block;
}

// We can remove this fully once we stop supporting tooltips

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.

comment: not sure we'll ever hit this as hasTooltip is never passed. Maybe we set this if tabIndex has been set?

@DipperTheDan DipperTheDan force-pushed the FE-7171-icon-ds-audit-updates branch 4 times, most recently from f9b64c4 to 176aa2d Compare May 13, 2026 14:36
Comment on lines -68 to -71
/** [Legacy] Provides a tooltip message when the icon is hovered. */
iconTooltipMessage?: string;
/** [Legacy] Provides positioning when the tooltip is displayed. */
iconTooltipPosition?: TooltipPositions;

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.

comment: I think we would still need to deprecate these props imo as removing them from the interface would be a breaking change, even if we are removing support.

nuria1110
nuria1110 previously approved these changes May 14, 2026
@DipperTheDan DipperTheDan force-pushed the FE-7171-icon-ds-audit-updates branch from a7400c5 to 98bb277 Compare May 15, 2026 08:42
edleeks87
edleeks87 previously approved these changes May 15, 2026
@DipperTheDan DipperTheDan marked this pull request as ready for review May 15, 2026 10:47
@DipperTheDan DipperTheDan dismissed stale reviews from edleeks87 and nuria1110 via e0145d2 May 15, 2026 14:43
@DipperTheDan DipperTheDan force-pushed the FE-7171-icon-ds-audit-updates branch from 85a707d to 2ec585a Compare May 29, 2026 09:55
@DipperTheDan DipperTheDan merged commit 3f9ee4d into master May 29, 2026
54 checks passed
@DipperTheDan DipperTheDan deleted the FE-7171-icon-ds-audit-updates branch May 29, 2026 14:22
@carbonci

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 159.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

7 participants