From 4f845144d3f44376529bf8c2d706179a59b63534 Mon Sep 17 00:00:00 2001 From: Mihai Albu Date: Fri, 19 Jul 2024 08:44:27 +0000 Subject: [PATCH] fix(flat-table): flat table contents visible behind sticky header/footer when the FlatTable is inside a Drawer with sticky header/footer overflow: auto should be applied closes: FE-6674 --- .../flat-table/flat-table-test.stories.tsx | 112 ++++++++++++++++++ .../flat-table/flat-table.component.tsx | 4 +- 2 files changed, 113 insertions(+), 3 deletions(-) diff --git a/src/components/flat-table/flat-table-test.stories.tsx b/src/components/flat-table/flat-table-test.stories.tsx index 005d961d48..8c7ed1ab04 100644 --- a/src/components/flat-table/flat-table-test.stories.tsx +++ b/src/components/flat-table/flat-table-test.stories.tsx @@ -19,6 +19,9 @@ import Link from "../../../src/components/link"; import guid from "../../__internal__/utils/helpers/guid"; import { FLAT_TABLE_THEMES } from "./flat-table.config"; import { WithSortingHeaders } from "./flat-table.stories"; +import Heading from "../../../src/components/heading"; +import Pager from "../../../src/components/pager"; +import Drawer from "../../../src/components/drawer"; export default { title: "Flat Table/Test", @@ -28,6 +31,8 @@ export default { "SortableStory", "SubRowsAsAComponentStory", "FlatTableSizeFocus", + "FlatTableInsideDrawer", + "TableInBox", ], parameters: { info: { disable: true }, @@ -496,3 +501,110 @@ export const FlatTableSizeFocus = () => { ); }; + +export const FlatTableInsideDrawer = () => { + return ( + + + + + + {}} + onLast={() => {}} + onNext={() => {}} + onPagination={() => {}} + onPrevious={() => {}} + pageSizeSelectionOptions={[ + { + id: "1", + name: 1, + }, + { + id: "10", + name: 10, + }, + { + id: "25", + name: 25, + }, + { + id: "50", + name: 50, + }, + { + id: "100", + name: 100, + }, + ]} + totalRecords="100" + /> + } + > + + + Name + Location + Relationship Status + Dependents + + + + {new Array(25) + .fill("") + .map((_, index) => index) + .map((key) => { + return ( + + Child one + York + Single + 2 + , + + Child two + Edinburgh + Single + 1 + , + ]} + > + John Doe + London + Single + 0 + + ); + })} + + + + + } + > +
+ + ); +}; diff --git a/src/components/flat-table/flat-table.component.tsx b/src/components/flat-table/flat-table.component.tsx index 61626be183..4960bd4995 100644 --- a/src/components/flat-table/flat-table.component.tsx +++ b/src/components/flat-table/flat-table.component.tsx @@ -221,9 +221,7 @@ export const FlatTable = ({ hasStickyHead={hasStickyHead} colorTheme={colorTheme} minHeight={minHeight} - overflowY={ - !isInSidebar && (hasStickyHead || hasStickyFooter) ? "auto" : undefined - } + overflowY={hasStickyHead || hasStickyFooter ? "auto" : undefined} height={addDefaultHeight && !hasMaxHeight ? "99%" : height} maxHeight={hasMaxHeight ? "100%" : undefined} display="flex"