File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import * as React from 'react';
22import classNames from 'classnames' ;
33import type { Placement } from './Drawer' ;
44import KeyCode from 'rc-util/lib/KeyCode' ;
5+ import { composeRef } from 'rc-util/lib/ref' ;
56
67export interface DrawerPanelRef {
78 focus : VoidFunction ;
@@ -16,6 +17,7 @@ export interface DrawerPanelProps {
1617 placement : Placement ;
1718 children ?: React . ReactNode ;
1819 onClose ?: React . KeyboardEventHandler < HTMLElement > ;
20+ containerRef ?: React . Ref < HTMLDivElement > ;
1921}
2022
2123const sentinelStyle : React . CSSProperties = {
@@ -37,6 +39,7 @@ const DrawerPanel = React.forwardRef<DrawerPanelRef, DrawerPanelProps>(
3739 height,
3840 children,
3941 onClose,
42+ containerRef,
4043 } = props ;
4144
4245 // ================================ Refs ================================
@@ -104,7 +107,7 @@ const DrawerPanel = React.forwardRef<DrawerPanelRef, DrawerPanelProps>(
104107 aria-modal = "true"
105108 role = "dialog"
106109 tabIndex = { - 1 }
107- ref = { panelRef }
110+ ref = { composeRef ( panelRef , containerRef ) }
108111 onKeyDown = { onPanelKeyDown }
109112 >
110113 < div
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import type { CSSMotionProps } from 'rc-motion';
55import type { DrawerPanelRef } from './DrawerPanel' ;
66import DrawerPanel from './DrawerPanel' ;
77import type ScrollLocker from 'rc-util/lib/Dom/scrollLocker' ;
8- import { composeRef } from 'rc-util/lib/ref' ;
98import DrawerContext from './context' ;
109import type { DrawerContextProps } from './context' ;
1110
@@ -253,7 +252,8 @@ export default function DrawerPopup(props: DrawerPopupProps) {
253252 { ( { className : motionClassName , style : motionStyle } , motionRef ) => {
254253 return (
255254 < DrawerPanel
256- ref = { composeRef ( motionRef , panelRef ) }
255+ ref = { panelRef }
256+ containerRef = { motionRef }
257257 prefixCls = { prefixCls }
258258 className = { classNames ( className , motionClassName ) }
259259 style = { {
You can’t perform that action at this time.
0 commit comments