-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The selected property issue on TabContainer #1953
Comments
Hi @mrmabo can you describe the steps by adding your code, the markup and the API calls you mentioned. If you create a codesandbox example, it would be great! BR, |
Hi @ilhan007 Here is what I tried, but it doesn't work
By adding a selected attribute, always selects the tab irrespective of the attribute value true or false. |
Hi @mrmabo This is one way how you can achieve the expected behaviour in React: function App () {
const [selectedTab, setSelectedTab] = useState(0);
setTimeout(() => {
setSelectedTab(selectedTab => 2)
}, 3000)
return (
<ui5-busyindicator style={{width: 100 + '%'}} active={selectedTab === 0 || undefined}>
<ui5-tabcontainer collapsed fixed show-overflow>
<ui5-tab text="Home" selected={selectedTab === 1 || undefined} />
<ui5-tab text="What's new" selected={selectedTab === 2 || undefined} />
<ui5-tab text="Who are we" selected={selectedTab === 3 || undefined} />
<ui5-tab text="About" selected={selectedTab === 4 || undefined} />
<ui5-tab text="Contacts" selected={selectedTab === 5 || undefined} />
</ui5-tabcontainer>
</ui5-busyindicator>
);
} Let me explain the code above:
Note: The behaviour of setting the first tab as selected if no tab is initially selected from our side will be fixed. |
Describe the bug
If the selected tab rendered due to the API response, the selected property on this tab cannot be invoked properly.
To reproduce
Steps to reproduce the behavior:
Expected behavior
Add boolean value on the selected attribute so that we can set the Prerequisites tab selected is true and other tabs selected is false after component renders.
Screenshots
Prerequisites tab base on the API response to render, and add the selected attribute on this tab. The content of Prerequisites will display underneath the content of Course Details.
Context
The text was updated successfully, but these errors were encountered: