@@ -16,32 +16,6 @@ interface DrawerProps {
1616 onClose ?: ( ) => void ;
1717}
1818
19- const useFocusedState = ( visible ?: boolean ) => {
20- const [ focused , setFocused ] = useState ( false ) ;
21- const onMouseEnter = useCallback ( ( ) => {
22- setFocused ( true ) ;
23- } , [ ] ) ;
24-
25- const onMouseLeave = useCallback ( ( ) => {
26- setFocused ( false ) ;
27- } , [ ] ) ;
28-
29- useEffect ( ( ) => {
30- if ( visible ) {
31- document . body . style . overflow = focused ? 'hidden' : 'unset' ;
32- }
33-
34- return ( ) => {
35- document . body . style . overflow = 'unset' ;
36- } ;
37- } , [ visible , focused ] ) ;
38-
39- return {
40- onMouseEnter,
41- onMouseLeave,
42- } ;
43- } ;
44-
4519const DrawerContext = React . createContext < Partial < { onClose ( ) : void } > > ( {
4620 onClose : ( ) => {
4721 throw new Error ( 'Not implemented' ) ;
@@ -68,7 +42,6 @@ export const Drawer: React.FC<React.PropsWithChildren<DrawerProps>> = ({
6842 const [ onESC ] = useKeyboard ( [ KeyCode . Escape ] , ( ) => onClose ?.( ) , {
6943 disableGlobalEvent : false ,
7044 } ) ;
71- const onFocusState = useFocusedState ( visible ) ;
7245
7346 const performState = useCallback ( ( condition : boolean , classes : [ string , string ] ) => {
7447 if ( drawerRef . current == null ) {
@@ -116,7 +89,6 @@ export const Drawer: React.FC<React.PropsWithChildren<DrawerProps>> = ({
11689 } ) }
11790 ref = { drawerRef }
11891 { ...onESC }
119- { ...onFocusState }
12092 >
12193 < DrawerContext . Provider value = { { onClose } } >
12294 < DrawerBody className = { s . DrawerWrapper } > { children } </ DrawerBody >
0 commit comments