question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tabs does not respond to container resizing

See original GitHub issue

What 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

  1. Step one
  2. Step two
  3. Step three
  4. 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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
emyarodcommented, Oct 21, 2020

yeah I can see that, may look into this further after some of the currently open Tabs issues have been resolved

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Tabs] Ink bar does not update when container resizes #6130
The issue to me appears that the _realignInkBar is only triggered by the _viewportRuler which is controlled by a window resize event. I ......
Read more >
Why does only the initially active Bootstrap tab respond ...
I am building a web app using Plotly Dash. The general layout can be seen in the attached screenshot 1. The HTML &...
Read more >
Tab Resize Not working in document.ready - Telerik Forums
I have code to resize my Tabs to match the browser size. The problem is when I call this method inside of $(document).ready...
Read more >
Apply constraints to define how layers resize
Constraints tell Figma how layers should respond when you resize their frames. This helps you to control how designs look across different screen...
Read more >
Resize ag-Grid With Parent Container
We can dynamically react to screen changes by making use of the grid API ... Open the example below in a new tab...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found