Skip to content

[Bug](react-icons): Hiding an Color Variant of icon causes duplicate icons on the same page to become invisible #936

@grhewitt

Description

@grhewitt

Package version

2.0.314

React version

18.3.1

Environment

I wasn't able to get this information as the command failed.

Current Behavior

When two instances of the same icon are present on the page and then the first becomes hidden for some reason, the second icon becomes invisible.

This seems to be due to the fact that the icons are using the same ids for their gradients, so the second icon is reading gradient information from the first icon's defs. When the first icon becomes hidden the second icon renders with invisible colors.

Expected Behavior

The second icon should not be affected by visibility changes to the first.

Reproduction

https://stackblitz.com/edit/6fkxxb34?file=src%2Fexample.tsx

Steps to reproduce

Use the toggle to hide and show the first icon, the second becomes invisible. You can also replace the duplicated icon with a different unique icon to see that the issue is exclusive to duplicated icons.

Are you reporting an Accessibility issue?

no

Suggested severity

Medium - Has workaround

Products/sites affected

No response

Are you willing to submit a PR to fix?

yes

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions