From bc2c812cbc9adb8a21b59cf2c03776f2b34ceb25 Mon Sep 17 00:00:00 2001 From: Katie McFaul Date: Thu, 23 Jul 2026 14:24:13 -0400 Subject: [PATCH] feat(Page): add ref prop for main element --- packages/react-core/src/components/Page/Page.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 = () => {};