File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
packages/kit-headless/src/components/modal Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 1
- import { QRL , QwikMouseEvent } from '@builder.io/qwik' ;
1
+ import { QwikMouseEvent } from '@builder.io/qwik' ;
2
2
import { FocusTrap , createFocusTrap } from 'focus-trap' ;
3
3
4
4
export type WidthState = {
@@ -36,20 +36,18 @@ export function deactivateFocusTrap(focusTrap: FocusTrap | null) {
36
36
* Applies a CSS-Class to animate the modal-showing.
37
37
* Calls the given callback that is executed after the Modal has been opened.
38
38
*/
39
- export async function showModal ( modal : HTMLDialogElement , onShow$ ?: QRL < ( ) => void > ) {
39
+ export async function showModal ( modal : HTMLDialogElement ) {
40
40
modal . showModal ( ) ;
41
41
supportShowAnimation ( modal ) ;
42
- await onShow$ ?.( ) ;
43
42
}
44
43
45
44
/**
46
45
* Closes the given Modal.
47
46
* Applies a CSS-Class to animate the Modal-closing.
48
47
* Calls the given callback that is executed after the Modal has been closed.
49
48
*/
50
- export async function closeModal ( modal : HTMLDialogElement , onClose$ ?: QRL < ( ) => void > ) {
49
+ export async function closeModal ( modal : HTMLDialogElement ) {
51
50
supportClosingAnimation ( modal , ( ) => modal . close ( ) ) ;
52
- await onClose$ ?.( ) ;
53
51
}
54
52
55
53
/**
Original file line number Diff line number Diff line change @@ -57,14 +57,15 @@ export const Modal = component$((props: ModalProps) => {
57
57
window . addEventListener ( 'keydown' , escapeKeydownHandler ) ;
58
58
59
59
if ( isOpen ) {
60
- showModal ( modal , props . onShow$ ) ;
60
+ showModal ( modal ) ;
61
+ props . onShow$ ?.( ) ;
61
62
adjustScrollbar ( scrollbar , modal ) ;
62
63
activateFocusTrap ( focusTrap ) ;
63
64
lockScroll ( ) ;
64
65
} else {
65
66
unlockScroll ( scrollbar ) ;
66
67
closeModal ( modal ) ;
67
- // animateClosing(modal, props.onClose$);
68
+ props . onClose$ ?. ( ) ;
68
69
}
69
70
70
71
cleanup ( ( ) => {
You can’t perform that action at this time.
0 commit comments