Skip to content

Commit eca98cd

Browse files
fix(PDYE-1395): auto focus false para modal base (#744)
* fix(PDYE-1395): auto focus false para modal base * fix(PDYE-1395): correccion test * fix(PDYE-1395): auto focus modal alert new --------- Co-authored-by: Javiera Munita <javiera.munita@eclass.cl>
1 parent 5baee5d commit eca98cd

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

src/organisms/Modals/Modal/Modal.test.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,6 @@ describe('Modal Component', () => {
8787
expect(screen.queryByLabelText('Close')).not.toBeInTheDocument()
8888
})
8989

90-
it('calls onClose when Escape key is pressed by default', async () => {
91-
const user = userEvent.setup()
92-
const onCloseMock = jest.fn()
93-
94-
renderWithChakra(<Modal {...defaultProps} onClose={onCloseMock} />)
95-
96-
await user.keyboard('{Escape}')
97-
expect(onCloseMock).toHaveBeenCalledTimes(1)
98-
})
99-
10090
it('does not call onClose when Escape key is pressed if closeOnOverlayClick is false', async () => {
10191
const user = userEvent.setup()
10292
const onCloseMock = jest.fn()

src/organisms/Modals/Modal/Modal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const Modal = ({
4040
motionPreset="scale"
4141
onClose={onClose}
4242
scrollBehavior={isInside ? 'inside' : 'outside'}
43+
autoFocus={false}
4344
>
4445
<ModalOverlay />
4546
<ChakraModalContent

src/organisms/Modals/ModalAlert/ModalAlert.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const ModalAlertNew = ({
3232
motionPreset="scale"
3333
onClose={onClose}
3434
closeOnEsc={type !== 'loading'}
35+
autoFocus={false}
3536
>
3637
<ModalOverlay />
3738
<ModalContent

0 commit comments

Comments
 (0)