Skip to content

Commit 81e672f

Browse files
snowystingerktaborsLFDanLu
authored
Remove persistent storybook button (#6044)
* Remove persistent storybook button * fix lint --------- Co-authored-by: Kyle Taborski <ktabors@yahoo.com> Co-authored-by: Daniel Lu <dl1644@gmail.com>
1 parent 449bc07 commit 81e672f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/react-aria-components/stories/Modal.stories.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const ModalExample = () => (
6262
);
6363

6464
export const ModalInteractionOutsideExample = () => {
65-
65+
6666
useEffect(() => {
6767
let button = document.createElement('button');
6868
button.id = 'test-button';
@@ -72,8 +72,12 @@ export const ModalInteractionOutsideExample = () => {
7272
button.style.right = '0';
7373
button.style.zIndex = '200';
7474
document.body.appendChild(button);
75+
76+
return () => {
77+
document.body.removeChild(button);
78+
};
7579
}, []);
76-
80+
7781
return (
7882
<DialogTrigger>
7983
<Button>Open modal</Button>
@@ -125,7 +129,7 @@ export const ModalInteractionOutsideExample = () => {
125129
};
126130

127131
export const ModalInteractionOutsideDefaultOverlayExample = () => {
128-
132+
129133
useEffect(() => {
130134
let button = document.createElement('button');
131135
button.id = 'test-button';
@@ -135,8 +139,11 @@ export const ModalInteractionOutsideDefaultOverlayExample = () => {
135139
button.style.right = '0';
136140
button.style.zIndex = '200';
137141
document.body.appendChild(button);
142+
return () => {
143+
document.body.removeChild(button);
144+
};
138145
}, []);
139-
146+
140147
return (
141148
<DialogTrigger>
142149
<Button>Open modal</Button>

0 commit comments

Comments
 (0)