You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the CSS from #16738 doesn’t quite achieve that for a couple of reasons:
It breaks markup where the first DOM child is a <Layer>, for example:
<TabPanel><Layerlevel={2}>…</Layer></TabPanel>
The CSS above overrides the tokens defined by the<Layer>, so the <Layer> component is essentially ignored.
Nested <Layer> components don’t work as expected either. For example, both these inputs appear the same, even though the <Layer> is supposed to give the second input a different background:
It's because although you defined the CSS tokens for level 2, the Layer context is still on level 1. They are out of sync.
It breaks backward compatibility with 1.60.0 (although perhaps this was intentional?), as code like below will show up with a different background color than previously:
If you want TabPanel to set up a Layer context, I think the right way to implement this would be for TabPanel to actually embed a <Layer> tag. Conceptually I think that makes sense but:
That would continue to break backward compatibility, see item 3 above.
If TabPanel sets a background color and embeds a <Layer> component, then shouldn't other components like Modal, Tile, etc. do the same?
If anyone is hitting this problem and looking for a quick imperfect workaround, this is what we did:
Following. We're running into similar layer issues within tabs trying to move up from @carbon/react 1.53.1 to 1.62.1.
Here's a simple example in screenshots. Note the search bar and empty state. It gets worse if an actual table is shown.
Package
@carbon/react
Browser
Chrome
Package version
1.61.0
React version
18
Description
PR #16738 broke the styling (background colors) for all our tabs, and also breaks the usage of
<Layer>
within tab panels.It's due to this SCSS below:
This CSS is conceptually similar to what we’ve been doing to declare tiles etc. which is essentially:
However, the CSS from #16738 doesn’t quite achieve that for a couple of reasons:
It breaks markup where the first DOM child is a
<Layer>
, for example:The CSS above overrides the tokens defined by the
<Layer>
, so the<Layer>
component is essentially ignored.Nested
<Layer>
components don’t work as expected either. For example, both these inputs appear the same, even though the<Layer>
is supposed to give the second input a different background:It's because although you defined the CSS tokens for level 2, the Layer context is still on level 1. They are out of sync.
It breaks backward compatibility with 1.60.0 (although perhaps this was intentional?), as code like below will show up with a different background color than previously:
If you want
TabPanel
to set up aLayer
context, I think the right way to implement this would be forTabPanel
to actually embed a<Layer>
tag. Conceptually I think that makes sense but:TabPanel
sets a background color and embeds a<Layer>
component, then shouldn't other components likeModal
,Tile
, etc. do the same?If anyone is hitting this problem and looking for a quick imperfect workaround, this is what we did:
Reproduction/example
https://stackblitz.com/edit/github-ihxqde?file=src%2FApp.jsx
Steps to reproduce
Just look at the stackblitz.
Suggested Severity
None
Application/PAL
IKC
Code of Conduct
The text was updated successfully, but these errors were encountered: