What package(s) are you using?
Detailed description
Describe in detail the issue you're having.
Issue: If <ExpandableTile/> is placed offscreen, and mounted for example in a <Tab/>, then the calculation for its maxHeight is wrong.
|
tileMaxHeight: this.aboveTheFold.getBoundingClientRect().height, |
It uses getBoundingClientRect() which returns 0 for all values, so the maxHeight is only calculated from padding:
|
: this.state.tileMaxHeight + this.state.tilePadding, |
Is this issue related to a specific component?
Yes, ExpandableTile
What did you expect to happen? What happened instead? What would you like to
see changed?
I expected to have same height for both tiles, regardless whether they're inside a hidden component or visible normally.
Maybe the prop tileMaxHeight can be used to override this calculation?
What browser are you working in?
Chrome
What version of the Carbon Design System are you using?
newest
Steps to reproduce the issue
- Open codesandbox
- Switch between tabs, see that unfolded height is different for the same component
Please create a reduced test case in CodeSandbox
https://codesandbox.io/s/keen-bush-ztref?file=/src/index.js
Additional information
properly calculated height (when visible on mount)

when switching to second tab, wrong height for the same component. it should be the same as on the first tab

What package(s) are you using?
carbon-componentscarbon-components-reactDetailed description
Issue: If
<ExpandableTile/>is placed offscreen, and mounted for example in a<Tab/>, then the calculation for its maxHeight is wrong.carbon/packages/react/src/components/Tile/Tile.js
Line 485 in 51ee1f5
It uses
getBoundingClientRect()which returns 0 for all values, so the maxHeight is only calculated from padding:carbon/packages/react/src/components/Tile/Tile.js
Line 571 in 51ee1f5
Yes,
ExpandableTileI expected to have same height for both tiles, regardless whether they're inside a hidden component or visible normally.
Maybe the prop
tileMaxHeightcan be used to override this calculation?Chrome
newest
Steps to reproduce the issue
https://codesandbox.io/s/keen-bush-ztref?file=/src/index.js
Additional information
properly calculated height (when visible on mount)

when switching to second tab, wrong height for the same component. it should be the same as on the first tab