File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
webdriver-ts-results/src/components/SelectionToolbar Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { BenchmarkType } from "@/Common" ;
2
2
import BenchmarkSelectorCategory from "./BenchmarkSelectorCategory" ;
3
3
import { Button , Modal } from "antd" ;
4
- import { useState } from "react" ;
4
+ import { useState , useEffect } from "react" ;
5
5
6
6
const content = (
7
7
< >
@@ -16,6 +16,10 @@ const BenchmarkSelector = () => {
16
16
17
17
const [ isModalOpen , setIsModalOpen ] = useState ( false ) ;
18
18
19
+ useEffect ( ( ) => {
20
+ isModalOpen ? ( document . body . style . overflow = "hidden" ) : document . body . style . removeProperty ( "overflow" ) ;
21
+ } , [ isModalOpen ] ) ;
22
+
19
23
const showModal = ( ) => {
20
24
setIsModalOpen ( true ) ;
21
25
} ;
@@ -33,7 +37,7 @@ const BenchmarkSelector = () => {
33
37
< Button type = "primary" onClick = { showModal } >
34
38
Which benchmarks?
35
39
</ Button >
36
- < Modal title = "Benchmarks selector" onOk = { handleOk } onCancel = { handleCancel } open = { isModalOpen } footer = { null } >
40
+ < Modal title = "Benchmarks selector" footer = { null } onOk = { handleOk } onCancel = { handleCancel } open = { isModalOpen } >
37
41
{ content }
38
42
</ Modal >
39
43
</ >
Original file line number Diff line number Diff line change 1
1
import { FrameworkType } from "@/Common" ;
2
2
import FrameworkSelectorCategory from "./FrameworkSelectorCategory" ;
3
3
4
- import { useState } from "react" ;
4
+ import { useState , useEffect } from "react" ;
5
5
import { Button , Modal } from "antd" ;
6
6
7
7
const content = (
@@ -16,6 +16,10 @@ const FrameworkSelector = () => {
16
16
17
17
const [ isModalOpen , setIsModalOpen ] = useState ( false ) ;
18
18
19
+ useEffect ( ( ) => {
20
+ isModalOpen ? ( document . body . style . overflow = "hidden" ) : document . body . style . removeProperty ( "overflow" ) ;
21
+ } , [ isModalOpen ] ) ;
22
+
19
23
const showModal = ( ) => {
20
24
setIsModalOpen ( true ) ;
21
25
} ;
You can’t perform that action at this time.
0 commit comments