File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 1- import * as React from 'react' ;
2- import KeyCode from 'rc-util/lib/KeyCode' ;
31import classNames from 'classnames' ;
2+ import KeyCode from 'rc-util/lib/KeyCode' ;
3+ import * as React from 'react' ;
44
55export interface NoticeConfig {
66 content ?: React . ReactNode ;
@@ -50,13 +50,11 @@ const Notify = React.forwardRef<HTMLDivElement, NoticeProps & { times?: number }
5050 onNoticeClose ( eventKey ) ;
5151 } ;
5252
53- const handleCloseKeydown : React . KeyboardEventHandler < HTMLAnchorElement > = closable
54- ? ( e ) => {
55- if ( e . key === 'Enter' || e . code === 'Enter' || e . keyCode === KeyCode . ENTER ) {
56- onInternalClose ( ) ;
57- }
58- }
59- : undefined ;
53+ const onCloseKeyDown : React . KeyboardEventHandler < HTMLAnchorElement > = ( e ) => {
54+ if ( e . key === 'Enter' || e . code === 'Enter' || e . keyCode === KeyCode . ENTER ) {
55+ onInternalClose ( ) ;
56+ }
57+ } ;
6058
6159 // ======================== Effect ========================
6260 React . useEffect ( ( ) => {
@@ -99,7 +97,7 @@ const Notify = React.forwardRef<HTMLDivElement, NoticeProps & { times?: number }
9997 < a
10098 tabIndex = { 0 }
10199 className = { `${ noticePrefixCls } -close` }
102- onKeyDown = { handleCloseKeydown }
100+ onKeyDown = { onCloseKeyDown }
103101 onClick = { ( e ) => {
104102 e . preventDefault ( ) ;
105103 e . stopPropagation ( ) ;
You can’t perform that action at this time.
0 commit comments