Skip to content

Commit

Permalink
Fix issue with tab panel not sizing to height of tabs component. (#2458)
Browse files Browse the repository at this point in the history
# Pull Request

## 🤨 Rationale

The update to the `Tabs` component introducing scroll buttons #2440 also
updated the `display` setting to `flex`. This resulted in a missed
change in behavior with how the `TabPanel` might size to the height of
the `Tabs` component. See [this
discussion](https://dev.azure.com/ni/DevCentral/_git/Skyline/pullrequest/821815?discussionId=7029412).

## 👩‍💻 Implementation

Just needed to set a style on `[part="tabpanel"]` to have `flex: 1;`.

## 🧪 Testing

Added a Chromatic test that would fail without the style change.

## ✅ Checklist

<!--- Review the list and put an x in the boxes that apply or ~~strike
through~~ around items that don't (along with an explanation). -->

- [ ] I have updated the project documentation to reflect my changes or
determined no changes are needed.
  • Loading branch information
Jonathan Meyer authored Oct 29, 2024
1 parent 92ad2f5 commit fae0aee
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix issue with tab panel not sizing to height of tabs component.",
"packageName": "@ni/nimble-components",
"email": "26874831+atmgrifter00@users.noreply.github.com",
"dependentChangeType": "patch"
}
4 changes: 4 additions & 0 deletions packages/nimble-components/src/patterns/tabs/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ export const styles = css`
[part='end'] {
flex: 1;
}
[part='tabpanel'] {
flex: 1;
}
`;
9 changes: 9 additions & 0 deletions packages/storybook/src/nimble/tabs/tabs-matrix.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,12 @@ export const panelOverflow: StoryFn = createStory(html`
<${tabPanelTag} style="width: 450px;">${loremIpsum}</${tabPanelTag}>
</${tabsTag}>
`);

export const panelSizeToContent: StoryFn = createStory(html`
<${tabsTag} style="width: 400px; height: 400px">
<${tabTag}>Tab One</${tabTag}>
<${tabPanelTag} style="width: 400px; height: 100%;">
<div style="width: 250px; height: 100%; background: red;"></div>
</${tabPanelTag}>
</${tabsTag}>
`);

0 comments on commit fae0aee

Please sign in to comment.