Skip to content

Commit

Permalink
Add label to TTS checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
ZEBAS204 committed Mar 24, 2023
1 parent 6d059ba commit af286de
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 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 Down Expand Up @@ -178,6 +178,7 @@ const InputTest = () => {

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

const [useTTS, setTTS] = useState(isTTSEnabled)

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

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

<Select
Expand Down

0 comments on commit af286de

Please sign in to comment.