Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: master to update_dependencies #207

Open
wants to merge 29 commits into
base: update_dependencies
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
de66844
Update deprecated workflow actions versions
ZEBAS204 Mar 21, 2023
c8373f4
Add min and max values to time selector
ZEBAS204 Mar 24, 2023
d9315f1
Make time selector arrows non-focusable
ZEBAS204 Mar 24, 2023
cf98f52
Add aria-busy to loading animation component
ZEBAS204 Mar 24, 2023
1d664ca
Hide slider guidance for screen readers
ZEBAS204 Mar 24, 2023
6d059ba
Label select elements for screen readers
ZEBAS204 Mar 24, 2023
af286de
Add label to TTS checkbox
ZEBAS204 Mar 24, 2023
e479641
Simplify aria-hidden
ZEBAS204 Mar 24, 2023
19d9adf
Label presets buttons for screen readers
ZEBAS204 Mar 25, 2023
ebdf408
Fix timer picker not using full width on chromium
ZEBAS204 Mar 25, 2023
dd80d72
Add focus to generate button
ZEBAS204 Mar 25, 2023
17d6ad3
Eliminate About section links redundancy
ZEBAS204 Mar 26, 2023
23456a5
Fix attributes typos
ZEBAS204 Mar 26, 2023
153734c
Label timer control inputs for screen readers
ZEBAS204 Mar 26, 2023
f9c7cd4
Pass props directory to clock
ZEBAS204 Mar 27, 2023
7913130
Add screen reader alerts to timer
ZEBAS204 Mar 27, 2023
8a83ab8
Remove improper attributes
ZEBAS204 Mar 27, 2023
1e4d21d
Update locales
ZEBAS204 Mar 27, 2023
581e9ae
Fix generate button not taking up full width
ZEBAS204 Mar 27, 2023
50d2a57
Fixed duplicated slider guidances
ZEBAS204 Mar 27, 2023
7ae2f40
Make service worker also cache fonts
ZEBAS204 Mar 28, 2023
ce51b6b
Do not show divider to screen readers
ZEBAS204 Mar 28, 2023
0cd1f91
Make flip words button act as checkbox
ZEBAS204 Mar 28, 2023
89a87fd
Make word box live regions for screen readers
ZEBAS204 Mar 28, 2023
a4b6e4d
Update tests
ZEBAS204 Mar 28, 2023
efa3a87
Hide time controls arrow buttons to screen readers
ZEBAS204 Mar 28, 2023
53ac8c0
Update injected title
ZEBAS204 Mar 29, 2023
8f619c8
Improve comments
ZEBAS204 Mar 29, 2023
7bc4c9a
Update i18n-ally descriptions
ZEBAS204 Mar 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check_pr_dependencies_updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Use Node.js v${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install project
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update_dependencies_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
name: Syncing branches
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 18
- name: Opening pull request
Expand Down
10 changes: 10 additions & 0 deletions .vscode/i18n-ally-reviews.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,13 @@ reviews:
description: >-
Dialogue message that will appear when you first open the page on a
small-screen device
timer.time_over:
description: Message for screen readers, displayed after the countdown is over
timer.time_remaining:
description: >-
Message for screen readers, displayed on intervals and when the time
remaining is 1min/30sec (you don't need to worry about time formatting)
timer.time_started:
description: Message for screen readers, displayed after the countdown started
about.desc_acknowledge:
description: Project description, over it is `about.desc`
2 changes: 1 addition & 1 deletion scripts/viteServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const viteServiceWorker = {

clientsClaim: true, // Needed for offline usage
skipWaiting: true, // Allow to trigger cache reload manually
globPatterns: ['**/*.{js,css,scss,html}'],
globPatterns: ['**/*.{js,css,scss,html,woff2}'],
runtimeCaching: [
{
urlPattern: ({ url }) => url.pathname.startsWith('/locales/'),
Expand Down
4 changes: 3 additions & 1 deletion src/__tests__/components/settings/Interface.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ describe('Interface settings', () => {
const Adjective = screen.getByText('common.adjective')
expect(Adjective).toBeDefined()

const WordFlipButton = screen.getByLabelText('settings.language_word_flip')
const WordFlipButton = screen.getByRole('checkbox', {
title: 'settings.language_word_flip',
})
fireEvent.click(WordFlipButton)

expect(SPY_wordFlip).toHaveBeenCalled()
Expand Down
6 changes: 5 additions & 1 deletion src/__tests__/components/timer/TimePicker.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ describe('Time Picker', () => {
)
})

const button = screen.getAllByRole('button')
const button = screen.getAllByRole('button', {
// This buttion has aria-hidden to prevent being accessible to screen readers
// it's not hidden but needs this property to be pick by the role selector
hidden: true,
})

// First button increases time
fireEvent.click(button[0])
Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box } from '@chakra-ui/react'

export default function Footer() {
return (
<Box aria-hidden="true">
<Box aria-hidden>
<Box
h={16}
clipPath="polygon(
Expand Down
5 changes: 1 addition & 4 deletions src/components/about/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ export default function about() {
return (
<>
<Text>
<Trans
i18nKey="about.desc"
components={[<Link href={__PROJECT_SOURCE__} isExternal />, <br />]}
/>
<Trans i18nKey="about.desc" components={[<br />]} />
</Text>
<br />
<Text>
Expand Down
53 changes: 36 additions & 17 deletions src/components/common/GenerateButton.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { memo, useCallback } from 'react'
import { Button } from '@chakra-ui/react'
import { Button, Box } from '@chakra-ui/react'
import { useKeyPressEvent } from 'react-use'

import { useTranslation } from 'react-i18next'
Expand Down Expand Up @@ -28,27 +28,46 @@ const GenerateButton = memo(({ generateWord }) => {
})

return (
<Button
aria-label={t('keybinds.words_desc')}
aria-keyshortcuts="Space"
onClick={generateWord}
fontFamily="Poppins"
fontWeight="700"
fontSize="2xl"
<Box
display="inline-flex"
w={['45%', '20%']}
p={8}
colorScheme="purple"
bg="#8969eb"
sx={{
'&:hover, &:active, &:focus-visible': {
bg: '#6e4fcf',
// Filter trick to add focus ring to clipPath
'--focus': 'var(--chakra-colors-blue-500)',
'&:focus-within': {
filter: `drop-shadow(1px 0 0 var(--focus))
drop-shadow(-1px 0 0 var(--focus))
drop-shadow(0 1px 0 var(--focus))
drop-shadow(0 -1px 0 var(--focus))
drop-shadow(1px 1px 0 var(--focus))
drop-shadow(-1px -1px 0 var(--focus))
drop-shadow(-1px 1px 0 var(--focus))
drop-shadow(1px -1px 0 var(--focus))`,
},
}}
color="#f0f0f0"
clipPath="polygon(0 20px, 20px 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 100% 100%, 0 100%)"
>
{t('buttons.regenerate')}
</Button>
<Button
aria-label={t('keybinds.words_desc')}
aria-keyshortcuts="Space"
onClick={generateWord}
fontFamily="Poppins"
fontWeight="700"
fontSize="2xl"
color="#f0f0f0"
bg="#8969eb"
w="100%"
p={8}
sx={{
'&:hover, &:active, &:focus': {
bg: '#6e4fcf',
boxShadow: 'none',
},
}}
clipPath="polygon(0 20px, 20px 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 100% 100%, 0 100%)"
>
{t('buttons.regenerate')}
</Button>
</Box>
)
})

Expand Down
3 changes: 2 additions & 1 deletion src/components/common/LoadingAnimation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ export const LoadingAnimationContainer = (props) => {
flexDir="column"
alignItems="center"
justifyContent="center"
aria-busy="true"
>
<LoadingAnimation {...animationProps} />
<LoadingAnimation {...animationProps} aria-hidden />
{showLabel && (
<Text position="relative" top="1em">
{t('common.loading')}...
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/ScrollMessage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function ScrollMessage() {
</AlertDialogHeader>

<AlertDialogBody display="flex" justifyContent="center">
<Box as={ScrollAnimation} w="full" h="8em" aria-hidden="true" />
<Box as={ScrollAnimation} w="full" h="8em" aria-hidden />
</AlertDialogBody>

<AlertDialogFooter justifyContent="center">
Expand Down
65 changes: 34 additions & 31 deletions src/components/generator/WordGenerator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,37 @@ import TTS from '@utils/tts'
import ContentError from './ContentError'
import useFetch from './UseFetch'

const WordBox = ({ word, isLoading, ...props }) => (
<Box
aria-live="polite"
aria-relevant="text"
bg="#fff"
_dark={{
bg: 'linear-gradient(to right, #6b4ecb 1%, #363e4d 1%, #363e4d 99%, #6b4ecb 99%)',
}}
p={[4, 8]}
rounded="20px"
_after={
import.meta.env.DEV && {
content: 'attr(aria-label)',
position: 'relative',
display: 'block',
transform: 'translate(-50%)',
inset: '-50% 0 0 15%',
color: '#00ff00',
h: 0,
}
}
{...props}
>
{isLoading ? (
<Skeleton w="50%" minH="1.5em" margin="0 auto" borderRadius={5} />
) : (
<Text>{word}</Text>
)}
</Box>
)

export default function WordGenerator() {
const { t } = useTranslation()
const [words, setWords] = useState({})
Expand Down Expand Up @@ -65,36 +96,6 @@ export default function WordGenerator() {
refetch()
}, [nounLang, adjLang])

const WordBox = ({ word, ...props }) => (
<Box
bg="#fff"
_dark={{
bg: 'linear-gradient(to right, #6b4ecb 1%, #363e4d 1%, #363e4d 99%, #6b4ecb 99%)',
}}
rounded="20px"
p={[4, 8]}
_after={
import.meta.env.DEV && {
content: 'attr(aria-label)',
position: 'relative',
display: 'block',
transform: 'translate(-50%)',
top: '-50%',
left: '15%',
color: '#00ff00',
h: 0,
}
}
{...props}
>
{isLoading ? (
<Skeleton w="50%" minH="1.5em" margin="0 auto" borderRadius={5} />
) : (
<Text>{word}</Text>
)}
</Box>
)

//* Prevent showing the ContentError Message on first renders
//* Without this, the error message will be shown before the word set
//* have been fetched or shuffled
Expand All @@ -120,8 +121,9 @@ export default function WordGenerator() {
word={isWordDisplayFlip ? words.noun : words.adj}
aria-label={t(`common.${isWordDisplayFlip ? 'noun' : 'adjective'}`)}
clipPath="polygon(0 0,25% 0,calc(25% + 15px) 15px,calc(75% - 15px) 15px,75% 0,100% 0,100% 100%,60% 100%,calc(60% - 20px) calc(100% - 20px),calc(40% + 20px) calc(100% - 20px),40% 100%,0 100%)"
{...isLoading}
/>
<Box h={0} aria-hidden="true">
<Box h={0} aria-hidden>
<Icon
as={RiAddLine}
color="#8a6aec"
Expand All @@ -146,6 +148,7 @@ export default function WordGenerator() {
100% 0,100% 100%,60% 100%,calc(60% - 20px) calc(100% - 20px),calc(40% + 20px) calc(100% - 20px),40% 100%,
0 100%)`,
]}
{...isLoading}
/>
</Grid>
)
Expand Down
38 changes: 20 additions & 18 deletions src/components/settings/Accessibility.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, useCallback, memo } from 'react'
import { useState, useEffect, useCallback, memo, useId } from 'react'
import { setData } from '@utils/appStorage'
import {
Divider,
Expand All @@ -21,22 +21,20 @@ import { wrapContext } from '@contexts/contextWrapper'
import TTS from '@utils/tts'

const Slider = (props) => (
<CSlider
aria-valuemin={1}
aria-valuemax={100}
min={1}
max={100}
step={1}
{...props}
>
<SliderTrack aria-hidden="true">
<CSlider min={1} max={100} step={1} {...props}>
<SliderTrack aria-hidden>
<SliderFilledTrack />
</SliderTrack>
{props.children}
</CSlider>
)
const SliderGuidance = ({ left, right }) => (
<Stack color="gray.400" direction="row" justifyContent="space-between">
<Stack
color="gray.400"
direction="row"
justifyContent="space-between"
aria-hidden
>
<Heading size="xs" as="h4">
{left}
</Heading>
Expand Down Expand Up @@ -68,11 +66,11 @@ const VolumeSlider = () => {
defaultValue={TTS._volume * 100}
>
<Tooltip
aria-hidden="true"
isOpen={displayVolumeTooltip}
label={volume}
placement="top"
hasArrow
aria-hidden
>
<SliderThumb />
</Tooltip>
Expand Down Expand Up @@ -107,11 +105,11 @@ const RateSlider = () => {
defaultValue={TTS._rate * 100}
>
<Tooltip
aria-hidden="true"
isOpen={displaySpeedTooltip}
label={speed}
placement="top"
hasArrow
aria-hidden
>
<SliderThumb />
</Tooltip>
Expand Down Expand Up @@ -173,6 +171,7 @@ const InputTest = () => {

const Accessibility = ({ isTTSEnabled, toggleSpeak }) => {
const { t } = useTranslation()
const ttsCheckboxId = useId()

const [useTTS, setTTS] = useState(isTTSEnabled)

Expand All @@ -199,8 +198,13 @@ const Accessibility = ({ isTTSEnabled, toggleSpeak }) => {

return (
<>
<SpacedStack heading={`${t('settings.tts')} (TTS)`} mt={0}>
<Switch onChange={toggleTTS} isChecked={useTTS} />
<SpacedStack
as="label"
htmlFor={ttsCheckboxId}
heading={`${t('settings.tts')} (TTS)`}
mt={0}
>
<Switch id={ttsCheckboxId} onChange={toggleTTS} isChecked={useTTS} />
</SpacedStack>

<Select
Expand All @@ -221,18 +225,16 @@ const Accessibility = ({ isTTSEnabled, toggleSpeak }) => {
}
</Select>

<Divider my={6} />
<Divider my={6} aria-hidden />

<Stack direction="column" px={3} gap={5}>
<Stack>
<SmallHeading>{t('settings.tts_volume')}</SmallHeading>
<VolumeSlider />
<SliderGuidance />
</Stack>
<Stack>
<SmallHeading>{t('settings.tts_rate')}</SmallHeading>
<RateSlider />
<SliderGuidance />
</Stack>
</Stack>
<InputTest />
Expand Down
Loading