Icon-button - in the outline version the border sinks behind parent background due to stacking context #15299
Labels
🐛 bug
Any issue that describes a bug
✅ status: resolved
Applies to issues that have pending PRs resolving them, or PRs that have already merged.
Description
The outline version of the icon button is created using an
::after
pseudo-element, which adds a border around the button. This element is assigned az-index: -1
, but this causes an issue when the button is placed within an element that has a background color.Due to the stacking context, the border is rendered behind the direct parent element's background since the button itself does not have a z-index.
Fix:
If the
z-index: -1
on the::after
element is not necessary remove it or if it's required addz-index: 0
to the button itselfSteps to reproduce
Result
The border goes behind the parent's background
Expected result
the border should be visible
Attachments
No background
![Image](https://private-user-images.githubusercontent.com/21260963/406398338-9c51522c-5964-4e8b-8e2d-3bc33eec7fea.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NDc1MDQsIm5iZiI6MTczOTQ0NzIwNCwicGF0aCI6Ii8yMTI2MDk2My80MDYzOTgzMzgtOWM1MTUyMmMtNTk2NC00ZThiLThlMmQtM2JjMzNlZWM3ZmVhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDExNDY0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU1ZDk2ZGE1ZjU1OTkxY2Y0MDhjMDJjZjAzZTc3MWIwNDI4ZGYyY2ExMzgyZGZhZTI2N2UxYTM1MDEzNmJkMjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.t4DddZ0z0H0m3aPAZULPn1h-Fhv0pe-PAndGZiacQJI)
Background (observe the last button)
![Image](https://private-user-images.githubusercontent.com/21260963/406398487-1933cbb3-8036-453a-8628-6b8d70f68477.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NDc1MDQsIm5iZiI6MTczOTQ0NzIwNCwicGF0aCI6Ii8yMTI2MDk2My80MDYzOTg0ODctMTkzM2NiYjMtODAzNi00NTNhLTg2MjgtNmI4ZDcwZjY4NDc3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDExNDY0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIyYjY5MzlmNjBkYTE5Mjc0MGJlZDM4YzU4MmNkMmZmYTc3OTg1MDM2NGVjYTk5MjM4MDE0YjZmNmViODBiMGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.xJGPKwYrfH-Va9pIVqwd656NjtOkGXiZ1arD-IsKdYY)
Expected
![Image](https://private-user-images.githubusercontent.com/21260963/406398571-da8f9625-136e-4591-8ab0-5a6ab1db49d7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NDc1MDQsIm5iZiI6MTczOTQ0NzIwNCwicGF0aCI6Ii8yMTI2MDk2My80MDYzOTg1NzEtZGE4Zjk2MjUtMTM2ZS00NTkxLThhYjAtNWE2YWIxZGI0OWQ3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDExNDY0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ0NGRhYjUxOWU4ZWNkN2ZkNDRlNjBmNDMyNjkxODg3NWZjYzliZmQ4MGIxMDNiNTY2M2E1Y2E4NDg5NzM0NGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.1Ha5ifC1q2ki4h5kYLEseeDiWP84TS1jAsyrVM1HNQk)
The text was updated successfully, but these errors were encountered: