Focus-trap: Use allowOutsideClick where appropriate

This commit is contained in:
Scott Nonnenberg 2021-10-06 13:56:37 -07:00 committed by GitHub
parent 048e1e4cd7
commit d542f450a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions

View file

@ -58,7 +58,12 @@ export const ModalHost = React.memo(
return root return root
? createPortal( ? createPortal(
<FocusTrap> <FocusTrap
focusTrapOptions={{
// This is alright because the overlay covers the entire screen
allowOutsideClick: false,
}}
>
<div <div
role="presentation" role="presentation"
className={classNames( className={classNames(

View file

@ -303,7 +303,11 @@ export const EmojiPicker = React.memo(
); );
return ( return (
<FocusTrap> <FocusTrap
focusTrapOptions={{
allowOutsideClick: true,
}}
>
<div className="module-emoji-picker" ref={ref} style={style}> <div className="module-emoji-picker" ref={ref} style={style}>
<header className="module-emoji-picker__header"> <header className="module-emoji-picker__header">
<button <button

View file

@ -148,7 +148,11 @@ export const StickerPicker = React.memo(
const showLongText = showPickerHint; const showLongText = showPickerHint;
return ( return (
<FocusTrap> <FocusTrap
focusTrapOptions={{
allowOutsideClick: true,
}}
>
<div className="module-sticker-picker" ref={ref} style={style}> <div className="module-sticker-picker" ref={ref} style={style}>
<div className="module-sticker-picker__header"> <div className="module-sticker-picker__header">
<div className="module-sticker-picker__header__packs"> <div className="module-sticker-picker__header__packs">