Not all tabs are always rendered in a tabset
See original GitHub issueI believe this is related to a certain DOM structure which I haven’t been able to nail down yet. What I do see is that TabSet.updateVisibleTabs is called after mount but this component has not yet been given a non-empty (0, 0, 0, 0) rect. When render is called on TabSet, it still has this.hideTabsAfter
as 0 even this, when render is called, the rect has been correctly set on the TabSetNode.
So between didMount (where updateVisibleTabs is called) and render the rect is set correctly but updateVisibleTabs is not set when the rect is updated. I have a temporary workaround but it’s not suitable for a PR as I’m sure there is a more elegant way to resolve this
const TabSet = require('flexlayout-react/lib/view/TabSet').TabSet;
// the tabset doesn't get it's dimensions depending on the container dom
// this patch ensures that it gets the correct dimensions (and renders the appropriate tabs)
function patchFlexLayout() {
const _render = TabSet.prototype.render;
TabSet.prototype.render = function() {
if (!this.updatedAfterVisible) {
const rect = this.props.node.getRect();
if (rect.width > 0) {
this.updatedAfterVisible = true;
this.recalcVisibleTabs = true;
this.updateVisibleTabs();
}
}
return _render.call(this);
};
}
patchFlexLayout();
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Tabsets not rendering datatables properly for Quarto Revealjs ...
I am making a presentation in Quarto using Revealjs. I would like each slide to contain a panel-tabset with multiple tabs, each containing...
Read more >Shinydashboard: render only the clicked tab - shiny
Hello. I am working on shinydashboard app with multiple tabs & I would like to render the tab content only when it is...
Read more >lightning-tabset - documentation - Salesforce Developers
A lightning-tabset displays a tabbed container with multiple content areas, only one of which is visible at a time. Tabs are displayed horizontally...
Read more >Conditional Rendering on component in drawer not picking up ...
Within the drawer is a tabset that contains a tab that is conditionally rendered. Currently when the drawer displays, the tab is always...
Read more >3.1 HTML document | R Markdown: The Definitive Guide
You can organize content using tabs by applying the .tabset class attribute to headers within a document. This will cause all sub-headers of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Joe, I was able to recreate the issue and have added a fix in 0.3.10
@nealus FWIW I ended up experiencing another bug after I added the monkey patch listed in the description where sometimes
this.toolbarRef
was undefined. I’m not quite sure why that would be happening but I did have to also add this to completely resolve my issue