Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* Fixed trace logger toggles [#3045](https://github.com/TryQuiet/quiet/issues/3045)
* Fixed auth issues when using QSS in AWS [#3128](https://github.com/TryQuiet/quiet/issues/3128)
* Fixed bug around killing old tor process that results in an unhandled exception [#3135](https://github.com/TryQuiet/quiet/issues/3135)
* Fixed bug that hardlocked users after pressing esc in the create community screen [#3017]
(https://github.com/TryQuiet/quiet/issues/3017)
* Fixed bug that caused a registration loop when QSS_ALLOWED is true but the endpoint is unset [#3140](https://github.com/TryQuiet/quiet/issues/3140)

### Chores
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,32 @@ describe('join community', () => {
expect(message).toBeVisible()
})

it('does not close on Escape when close is disabled', async () => {
const { store } = await prepareStore()
const handleClose = jest.fn()

renderComponent(
<PerformCommunityActionComponent
open={true}
handleClose={handleClose}
communityOwnership={CommunityOwnership.User}
handleCommunityAction={() => {}}
handleRedirection={() => {}}
isConnectionReady={true}
isCloseDisabled={true}
hasReceivedResponse={false}
/>,
store
)

const input = screen.getByPlaceholderText(inviteLinkField().fieldProps.placeholder)
input.focus()

await userEvent.keyboard('{Escape}')

expect(handleClose).not.toHaveBeenCalled()
})

it('blocks submit button if connection is not ready', async () => {
const { store } = await prepareStore()
const handleCommunityAction = jest.fn()
Expand Down
19 changes: 18 additions & 1 deletion packages/desktop/src/renderer/components/ui/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,25 @@ export const Modal: React.FC<IModalProps> = ({
...otherProps
}) => {
const zIndex = 1300

const onClose: MaterialModalProps['onClose'] = (event, reason) => {
if (isCloseDisabled && (reason === 'escapeKeyDown' || reason === 'backdropClick')) {
return
}

if (handleClose) {
return handleClose(event, reason)
}
}

return (
<StyledMaterialModal zIndex={zIndex} open={open} onClose={handleClose} {...otherProps}>
<StyledMaterialModal
zIndex={zIndex}
open={open}
onClose={onClose}
disableEscapeKeyDown={isCloseDisabled}
{...otherProps}
>
<Grid
container
direction='column'
Expand Down
Loading