Skip to content

Commit

Permalink
[DATA GRID] Fix fullscreen scrolling issues (#4477)
Browse files Browse the repository at this point in the history
* Fix fullscreen scrolling issues

* cl
  • Loading branch information
snide authored Feb 4, 2021
1 parent f01c84b commit b52816a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

- Fixed `id` usage throughout `EuiTreeView` to respect custom ids and stop conflicts in generated ids ([#4435](https://github.com/elastic/eui/pull/4435))
- Fixed `EuiTabs` `role` if no tabs are passed in ([#4435](https://github.com/elastic/eui/pull/4435))
- Fixed issue in `EuiDataGrid` where the horizontal scrollbar was hidden behind pagination ([#4477](https://github.com/elastic/eui/pull/4477))
- Fixed `EuiPopover` with initial `isOpen` working with `EuiOutsideClickDetector` ([#4461](https://github.com/elastic/eui/pull/4461))
- Fixed `EuiDataGridCellPopover` needing 2 state updates to close ([#4461](https://github.com/elastic/eui/pull/4461))
- Fixed `EuiBadge` with `iconOnClick` from catching form submit events ([#4479](https://github.com/elastic/eui/pull/4479))
Expand Down
4 changes: 4 additions & 0 deletions src/components/datagrid/data_grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,9 @@ export const EuiDataGrid: FunctionComponent<EuiDataGridProps> = (props) => {

// enables/disables grid controls based on available width
const [resizeRef, setResizeRef] = useState<HTMLDivElement | null>(null);
const [toolbarRef, setToolbarRef] = useState<HTMLDivElement | null>(null);
const gridDimensions = useResizeObserver(resizeRef, 'width');
const toolbarDemensions = useResizeObserver(toolbarRef, 'height');
useEffect(() => {
if (resizeRef) {
const { width } = gridDimensions;
Expand Down Expand Up @@ -996,6 +998,7 @@ export const EuiDataGrid: FunctionComponent<EuiDataGridProps> = (props) => {
<>
{showToolbar ? (
<div
ref={setToolbarRef}
className="euiDataGrid__controls"
data-test-sub="dataGridControls">
{hasRoomForGridControls ? gridControls : null}
Expand Down Expand Up @@ -1047,6 +1050,7 @@ export const EuiDataGrid: FunctionComponent<EuiDataGridProps> = (props) => {
columns={orderedVisibleColumns}
columnWidths={columnWidths}
defaultColumnWidth={defaultColumnWidth}
toolbarHeight={toolbarDemensions.height}
leadingControlColumns={
leadingControlColumns
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/datagrid/data_grid_body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export interface EuiDataGridBodyProps {
handleHeaderMutation: MutationCallback;
setVisibleColumns: EuiDataGridHeaderRowProps['setVisibleColumns'];
switchColumnPos: EuiDataGridHeaderRowProps['switchColumnPos'];
toolbarHeight: number;
}

const defaultComparator: NonNullable<
Expand Down Expand Up @@ -317,6 +318,7 @@ export const EuiDataGridBody: FunctionComponent<EuiDataGridBodyProps> = (
handleHeaderMutation,
setVisibleColumns,
switchColumnPos,
toolbarHeight,
} = props;

const [headerRowRef, setHeaderRowRef] = useState<HTMLDivElement | null>(null);
Expand Down Expand Up @@ -560,7 +562,8 @@ export const EuiDataGridBody: FunctionComponent<EuiDataGridBodyProps> = (
let finalHeight = IS_JEST_ENVIRONMENT ? 500 : height || unconstrainedHeight;
let finalWidth = IS_JEST_ENVIRONMENT ? 500 : width || unconstrainedWidth;
if (isFullScreen) {
finalHeight = window.innerHeight;
finalHeight =
window.innerHeight - toolbarHeight - headerRowHeight - footerRowHeight;
finalWidth = window.innerWidth;
}

Expand Down

0 comments on commit b52816a

Please sign in to comment.