From e7781a6baf2e4b98da85b19463a7a24bb613e73c Mon Sep 17 00:00:00 2001 From: Katie McFaul Date: Thu, 23 Jul 2026 14:24:13 -0400 Subject: [PATCH 1/2] 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 = () => {}; From 91736fe3224164015b471c799c97c5a33c1335c5 Mon Sep 17 00:00:00 2001 From: Katie McFaul Date: Wed, 29 Jul 2026 11:44:12 -0400 Subject: [PATCH 2/2] remove mainRef from spread props --- packages/react-core/src/components/Page/Page.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react-core/src/components/Page/Page.tsx b/packages/react-core/src/components/Page/Page.tsx index 614db667d53..034c72f9787 100644 --- a/packages/react-core/src/components/Page/Page.tsx +++ b/packages/react-core/src/components/Page/Page.tsx @@ -275,6 +275,8 @@ class Page extends Component { groupProps, breadcrumbProps, isContentFilled, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + mainRef, ...rest } = this.props; const { mobileView, mobileIsSidebarOpen, desktopIsSidebarOpen, width, height } = this.state;