Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Rainbow Button Z-Index Issues in Stacking Contexts
Problem
The rainbow/brand variant of the Button component was experiencing z-index issues in certain stacking contexts, causing the gradient background to appear behind other elements or not display correctly. This was due to the use of CSS pseudo-elements (
::beforeand::after) for the gradient background, which created stacking context problems.Root Cause
The original implementation used CSS pseudo-elements for the brand variant's gradient background:
Pseudo-elements create their own stacking contexts and can be affected by the parent element's z-index, transform, opacity, and other CSS properties that create new stacking contexts. This caused the gradient to appear behind other elements in complex layouts.
Solution
Replaced the pseudo-element approach with actual child elements to avoid stacking context issues:
Key Changes
<span>element instead of::beforepseudo-elementz-10, content span hasz-20flex items-center justify-centerto the content span to preserve icon alignmentasChildis trueWhy This Works