Skip to content

Commit 03484ee

Browse files
committed
fix: Set width and height to 0 for visuallyHidden components to avoid double scroll bar
1 parent 07af6c5 commit 03484ee

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/client/components/NavBar/NavBar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ const NavBar = ({ guest = false }) => {
289289
{LANGUAGES.map(l => (
290290
<MenuItem key={l} sx={i18n.language === l && styles.activeItem} onClick={() => changeLanguage(l)}>
291291
<span aria-hidden="true">{l.toUpperCase()}</span>
292-
<span style={visuallyHidden}>{t(`common:languageMenu:${l}`)}</span>
292+
<span style={{ ...visuallyHidden, width: '0px', height: '0px' }}>{t(`common:languageMenu:${l}`)}</span>
293293
</MenuItem>
294294
))}
295295
{!guest && <Divider component="li" sx={styles.languageMenuDivider} />}

src/client/components/common/ExternalLink.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import { useTranslation } from 'react-i18next'
3-
import { Link } from '@mui/material'
3+
import { Link, Box } from '@mui/material'
44
import ExternalLinkIcon from '@mui/icons-material/OpenInNew'
55
import { visuallyHidden } from '@mui/utils'
66

@@ -18,7 +18,9 @@ const ExternalLink = ({ children, ...props }) => {
1818
<Link target="_blank" rel="noopener" {...props} underline="always">
1919
{children}
2020
<ExternalLinkIcon sx={styles.icon} aria-hidden="true" />
21-
<span style={visuallyHidden}>{t('common:opensInNewTab')}</span>
21+
<Box component="span" sx={{ ...visuallyHidden, width: '0px', height: '0px' }}>
22+
{t('common:opensInNewTab')}
23+
</Box>
2224
</Link>
2325
)
2426
}

src/client/components/common/LinkButton.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import { useTranslation } from 'react-i18next'
33
import { Link } from 'react-router-dom'
4-
import { Button, Link as MuiLink } from '@mui/material'
4+
import { Button, Link as MuiLink, Box } from '@mui/material'
55
import { OpenInNew } from '@mui/icons-material'
66
import { visuallyHidden } from '@mui/utils'
77

@@ -27,7 +27,11 @@ const LinkButton = ({ title, to, external = false, ...rest }) => {
2727
sx={{ textDecoration: 'underline', '&:hover': { textDecoration: 'underline' } }}
2828
>
2929
{title}
30-
{external && <span style={visuallyHidden}>{t('common:opensInNewTab')}</span>}
30+
{external && (
31+
<Box component="span" sx={{ ...visuallyHidden, width: '0px', height: '0px' }}>
32+
{t('common:opensInNewTab')}
33+
</Box>
34+
)}
3135
</Button>
3236
)
3337
}

0 commit comments

Comments
 (0)