All of the Kendo components that "hide" content (tab views, collapse panels, etc) don't actually hide any content. They require us to not render any children.
<ExpansionPanel
{expanded === item.id && (
<ExpansionPanelContent>
This just strikes me as an odd design decision. I guess I don't understand the point of these components if they don't do the 1 thing they are supposed to do; hide portions of the content.
Un-rendering the content is usually not desirable. The contents are often still important. Possibly for SEO purposes, A11y, or if they are part of a Form:
<Form
render={() => {
<FormElement>
<ExpansionPanel>
{expanded === item.id && (
<ExpansionPanelContent>
<Field
name={"firstName"}
component={Input}
validator={() => 'always invalid'}
/>
</ExpansionPanelContent>
</ExpansionPanel>
</FormElement>
}}
/>
This makes the Form valid as long as the panel is collapsed.
Can check out how Bootstrap collapse panels work to see how most people would expect these components to behave. The contents is rendered into the DOM and JS and CSS are used to hide it. There should be a way to achieve this same behavior with Kendo.
As a workaround I end up having to do my own CSS/SASS to hide the contents
.k-expander {
.k-expander-content-wrapper {
height: 0;
overflow: hidden;
}
&.k-expanded {
.k-expander-content-wrapper {
height: auto;
}
}
}