-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35572 from ntdiary/fix-restore-focus-29011
phase1: fix emoji picker refocus issue
- Loading branch information
Showing
10 changed files
with
323 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type {ReactNode} from 'react'; | ||
import React from 'react'; | ||
|
||
type ModalContentProps = { | ||
/** Modal contents */ | ||
children: ReactNode; | ||
|
||
/** | ||
* Callback method fired after modal content is unmounted. | ||
* isVisible is not enough to cover all modal close cases, | ||
* such as closing the attachment modal through the browser's back button. | ||
* */ | ||
onDismiss: () => void; | ||
}; | ||
|
||
function ModalContent({children, onDismiss = () => {}}: ModalContentProps) { | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
React.useEffect(() => () => onDismiss?.(), []); | ||
return children; | ||
} | ||
ModalContent.displayName = 'ModalContent'; | ||
|
||
export default ModalContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.