Skip to content

Commit

Permalink
Merge pull request #31256 from dukenv0307/fix/30045
Browse files Browse the repository at this point in the history
Fix: Only the delete confirmation modal should close when pressing ESC button
  • Loading branch information
MariaHCD authored Nov 27, 2023
2 parents 6904fb1 + c63d370 commit c687387
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ function AttachmentModal(props) {
const [isDownloadButtonReadyToBeShown, setIsDownloadButtonReadyToBeShown] = React.useState(true);
const {windowWidth} = useWindowDimensions();

const isOverlayModalVisible = (isAttachmentReceipt && isDeleteReceiptConfirmModalVisible) || (!isAttachmentReceipt && isAttachmentInvalid);

const [file, setFile] = useState(
props.originalFileName
? {
Expand Down Expand Up @@ -406,7 +408,7 @@ function AttachmentModal(props) {
<Modal
type={modalType}
onSubmit={submitAndClose}
onClose={closeModal}
onClose={isOverlayModalVisible ? closeConfirmModal : closeModal}
isVisible={isModalOpen}
backgroundColor={theme.componentBG}
onModalShow={() => {
Expand Down

0 comments on commit c687387

Please sign in to comment.