diff --git a/packages/react-core/src/components/Page/Page.tsx b/packages/react-core/src/components/Page/Page.tsx index 37b97f709d3..614db667d53 100644 --- a/packages/react-core/src/components/Page/Page.tsx +++ b/packages/react-core/src/components/Page/Page.tsx @@ -97,6 +97,8 @@ export interface PageProps extends React.HTMLProps { horizontalSubnav?: React.ReactNode; /** Accessible label, can be used to name main section */ mainAriaLabel?: string; + /** Reference for the main section of the page */ + mainRef?: React.RefObject; /** Flag indicating if the horizontal sub navigation should be in a group */ isHorizontalSubnavGrouped?: boolean; /** Flag indicating if the breadcrumb should be in a group */ @@ -132,9 +134,10 @@ class Page extends Component { onNotificationDrawerExpand: () => null, mainComponent: 'main', getBreakpoint, - getVerticalBreakpoint + getVerticalBreakpoint, + mainRef: undefined }; - mainRef = createRef(); + mainRef = this.props?.mainRef ? this.props.mainRef : createRef(); pageRef = createRef(); observer: any = () => {};