Skip to content

Commit

Permalink
fix: client modal glitches on Integrations-page (#7056)
Browse files Browse the repository at this point in the history
* ocrvs-7002

* replaced 'auto' with 'scroll'

* changelog.md updated

* fix: react issue with exhaustive deps

---------

Co-authored-by: Pyry <pyry.rouvila@gmail.com>
  • Loading branch information
2 people authored and Zangetsu101 committed Jun 7, 2024
1 parent 43e8b1a commit e3fdfbb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
- Fix issues of invisible inputs when navigating from can't login link in login page [#6163](https://github.com/opencrvs/opencrvs-core/issues/6163)
- Fix print record page for an unsaved declaration [#6893](https://github.com/opencrvs/opencrvs-core/issues/6893)
- Fix dashboard cron jobs not working [#7016](https://github.com/opencrvs/opencrvs-core/issues/7016)
- Fix client modal glitches on integrations page [#7002] (https://github.com/opencrvs/opencrvs-core/issues/7002)

## Refactor

Expand Down
10 changes: 5 additions & 5 deletions packages/components/src/ResponsiveModal/ResponsiveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/
import React, { useEffect } from 'react'
import React, { useCallback, useEffect } from 'react'
import styled from 'styled-components'
import { Cross } from '../icons'
import { CircleButton } from '../buttons'
Expand Down Expand Up @@ -110,7 +110,7 @@ const Body = styled.div<{
height ? `${height}px` : autoHeight ? `auto` : `250px`};
max-height: calc(100vh - 180px);
color: ${({ theme }) => theme.colors.supportingCopy};
overflow-y: ${({ scrollableY }) => (scrollableY ? 'visible' : 'auto')};
overflow-y: ${({ scrollableY }) => (scrollableY ? 'visible' : 'scroll')};
padding: 0 24px 16px;
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -186,13 +186,13 @@ export const ResponsiveModal = ({
showHeaderBorder,
children
}: IProps) => {
const toggleScroll = () => {
const toggleScroll = useCallback(() => {
const body = document.querySelector('body') as HTMLBodyElement
if (show) {
return (body.style.overflow = 'hidden')
}
return body.style.removeProperty('overflow')
}
}, [show])

useEffect(() => {
toggleScroll()
Expand All @@ -201,7 +201,7 @@ export const ResponsiveModal = ({
const body = document.querySelector('body') as HTMLBodyElement
body.style.removeProperty('overflow')
}
}, [show])
}, [show, toggleScroll])

if (!show) {
return null
Expand Down

0 comments on commit e3fdfbb

Please sign in to comment.