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';
2
2
import classNames from 'classnames' ;
3
3
import type { Placement } from './Drawer' ;
4
4
import KeyCode from 'rc-util/lib/KeyCode' ;
5
+ import { composeRef } from 'rc-util/lib/ref' ;
5
6
6
7
export interface DrawerPanelRef {
7
8
focus : VoidFunction ;
@@ -16,6 +17,7 @@ export interface DrawerPanelProps {
16
17
placement : Placement ;
17
18
children ?: React . ReactNode ;
18
19
onClose ?: React . KeyboardEventHandler < HTMLElement > ;
20
+ containerRef ?: React . Ref < HTMLDivElement > ;
19
21
}
20
22
21
23
const sentinelStyle : React . CSSProperties = {
@@ -37,6 +39,7 @@ const DrawerPanel = React.forwardRef<DrawerPanelRef, DrawerPanelProps>(
37
39
height,
38
40
children,
39
41
onClose,
42
+ containerRef,
40
43
} = props ;
41
44
42
45
// ================================ Refs ================================
@@ -104,7 +107,7 @@ const DrawerPanel = React.forwardRef<DrawerPanelRef, DrawerPanelProps>(
104
107
aria-modal = "true"
105
108
role = "dialog"
106
109
tabIndex = { - 1 }
107
- ref = { panelRef }
110
+ ref = { composeRef ( panelRef , containerRef ) }
108
111
onKeyDown = { onPanelKeyDown }
109
112
>
110
113
< div
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import type { CSSMotionProps } from 'rc-motion';
5
5
import type { DrawerPanelRef } from './DrawerPanel' ;
6
6
import DrawerPanel from './DrawerPanel' ;
7
7
import type ScrollLocker from 'rc-util/lib/Dom/scrollLocker' ;
8
- import { composeRef } from 'rc-util/lib/ref' ;
9
8
import DrawerContext from './context' ;
10
9
import type { DrawerContextProps } from './context' ;
11
10
@@ -253,7 +252,8 @@ export default function DrawerPopup(props: DrawerPopupProps) {
253
252
{ ( { className : motionClassName , style : motionStyle } , motionRef ) => {
254
253
return (
255
254
< DrawerPanel
256
- ref = { composeRef ( motionRef , panelRef ) }
255
+ ref = { panelRef }
256
+ containerRef = { motionRef }
257
257
prefixCls = { prefixCls }
258
258
className = { classNames ( className , motionClassName ) }
259
259
style = { {
You can’t perform that action at this time.
0 commit comments