Tabs does not respond to container resizing
See original GitHub issueWhat package(s) are you using?
-
carbon-components
-
carbon-components-react
Detailed description
Describe in detail the issue you’re having.
If Tabs is placed in a container that supports resizing (e.g. a container with a resize: both
css rule), the Tabs
component does not respond to container resizing. Looking at the source, I see that it only responds to window-level resizing.
The fix would be to use a ResizeObserver, and attach it to the Tabs ref, e.g. via
const observer = new ResizeObserver(entries => {
doResize(entries[0].contentRect.width, entries[0].contentRect.height)
})
observer.observe(theTabsDom)
Is this issue related to a specific component?
Tabs
What did you expect to happen? What happened instead? What would you like to see changed?
<div style={{resize: 'both', overflow: 'auto'}}>
<Tabs>...</Tabs>
</div>
What browser are you working in?
Electron 7, Firefox, Chrome, …
What version of the Carbon Design System are you using?
What offering/product do you work on? Any pressing ship or release dates we should be aware of?
Kui
Steps to reproduce the issue
- Step one
- Step two
- Step three
- etc.
Please create a reduced test case in CodeSandbox
i’d love to create a sandbox, but your template seems to be broken.
Additional information
- Screenshots or code
- Notes
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
yeah I can see that, may look into this further after some of the currently open Tabs issues have been resolved
https://codesandbox.io/s/quirky-resonance-4j78i