Skip to content

Commit 847f47e

Browse files
fix(PDYE-1395): auto focus props (#745)
Co-authored-by: Javiera Munita <javiera.munita@eclass.cl>
1 parent eca98cd commit 847f47e

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/organisms/Modals/Modal/Modal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const Modal = ({
2323
withoutMargin = false,
2424
scrollBehavior = 'outside',
2525
fixedButtons = false,
26+
autoFocus = false,
2627
}: IModal): JSX.Element => {
2728
const py = '32px'
2829
const px = '24px'
@@ -40,7 +41,7 @@ export const Modal = ({
4041
motionPreset="scale"
4142
onClose={onClose}
4243
scrollBehavior={isInside ? 'inside' : 'outside'}
43-
autoFocus={false}
44+
autoFocus={autoFocus}
4445
>
4546
<ModalOverlay />
4647
<ChakraModalContent

src/organisms/Modals/ModalAlert/ModalAlert.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { alertColorStates } from '@/organisms/Alerts/utils/alertStates'
1414
import { vars } from '@/theme'
1515

1616
export const ModalAlertNew = ({
17+
autoFocus = false,
1718
type,
1819
isOpen,
1920
onClose,
@@ -32,7 +33,7 @@ export const ModalAlertNew = ({
3233
motionPreset="scale"
3334
onClose={onClose}
3435
closeOnEsc={type !== 'loading'}
35-
autoFocus={false}
36+
autoFocus={autoFocus}
3637
>
3738
<ModalOverlay />
3839
<ModalContent

src/organisms/Modals/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface IModal {
1313
scrollBehavior?: 'inside' | 'outside'
1414
/** Si esta activo se fija el footer */
1515
fixedButtons?: boolean
16+
autoFocus?: boolean
1617
}
1718

1819
export interface IModalButtons {
@@ -25,6 +26,7 @@ export interface IModalButtons {
2526
}
2627

2728
export interface IModalAlert {
29+
autoFocus?: boolean
2830
children?: React.ReactNode
2931
isOpen: boolean
3032
onClose: () => void

0 commit comments

Comments
 (0)