The swiss army knife of lossless video/audio editing
a11y highlightedtext
Mikael Finstad25110753b2e7
diff --git a/src/renderer/src/components/ExportConfirm.tsx b/src/renderer/src/components/ExportConfirm.tsxindex e593e641..10e0fc43 100644--- a/src/renderer/src/components/ExportConfirm.tsx+++ b/src/renderer/src/components/ExportConfirm.tsx@@ -8,7 +8,7 @@ import type { SweetAlertIcon } from 'sweetalert2';import ExportButton from './ExportButton';import ExportModeButton from './ExportModeButton';import FileNameTemplateEditor from './FileNameTemplateEditor';-import HighlightedText, { highlightedTextStyle } from './HighlightedText';+import HighlightedText from './HighlightedText';import Select from './Select';import Switch from './Switch';@@ -30,8 +30,6 @@ import { LossyMode } from '../../../main';import AnimatedTr from './AnimatedTr';-const outDirStyle: CSSProperties = { ...highlightedTextStyle, wordBreak: 'break-all', cursor: 'pointer' };-const noticeStyle: CSSProperties = { marginBottom: '.5em' };const infoStyle: CSSProperties = { ...noticeStyle, color: 'var(--blue-12)' };const warningStyle: CSSProperties = { ...noticeStyle, color: 'var(--orange-8)' };@@ -373,7 +371,7 @@ function ExportConfirm({{t('Save output to path:')}</td><td>- <span role="button" onClick={changeOutDir} style={outDirStyle}>{outputDir}</span>+ <HighlightedText role="button" onClick={changeOutDir} style={{ wordBreak: 'break-all', cursor: 'pointer' }}>{outputDir}</HighlightedText></td><td /></tr>diff --git a/src/renderer/src/components/FileNameTemplateEditor.tsx b/src/renderer/src/components/FileNameTemplateEditor.tsxindex c74e4329..573b4c35 100644--- a/src/renderer/src/components/FileNameTemplateEditor.tsx+++ b/src/renderer/src/components/FileNameTemplateEditor.tsx@@ -163,7 +163,7 @@ function FileNameTemplateEditor(opts: {<motion.div animate={{ marginBottom: needToShow ? '1.5em' : '.3em' }}>{generated != null && (<div style={{ marginBottom: '.3em' }}>- <HighlightedText role="button" onClick={onShowClick} tabIndex={0} style={{ wordBreak: 'break-word', cursor: needToShow ? undefined : 'pointer' }}>+ <HighlightedText role="button" onClick={onShowClick} style={{ wordBreak: 'break-word', cursor: needToShow ? undefined : 'pointer' }}>{generated.originalFileNames != null && formatCurrentSegFileOrFirst(generated.fileNames)}<span style={generated.originalFileNames != null ? { textDecoration: 'line-through', marginLeft: '.3em', color: dangerColor } : undefined}>{formatCurrentSegFileOrFirst(generated.originalFileNames ?? generated.fileNames)}</span>{!needToShow && <FaEdit style={{ fontSize: '.9em', marginLeft: '.4em', verticalAlign: 'middle' }} />}diff --git a/src/renderer/src/components/HighlightedText.module.css b/src/renderer/src/components/HighlightedText.module.cssnew file mode 100644index 00000000..e218106b--- /dev/null+++ b/src/renderer/src/components/HighlightedText.module.css@@ -0,0 +1,11 @@+.button {+ all: unset;+ text-decoration: underline;+ text-underline-offset: .2em;+ color: var(--gray-12);+ border-radius: .4em;+}++.button:focus {+ outline: .1em solid var(--gray-12);+}diff --git a/src/renderer/src/components/HighlightedText.tsx b/src/renderer/src/components/HighlightedText.tsxindex 8f9c4ccd..508f3fb8 100644--- a/src/renderer/src/components/HighlightedText.tsx+++ b/src/renderer/src/components/HighlightedText.tsx@@ -1,12 +1,13 @@import { CSSProperties, HTMLAttributes, memo } from 'react';import { primaryTextColor } from '../colors';+import styles from './HighlightedText.module.css';-export const highlightedTextStyle: CSSProperties = { textDecoration: 'underline', textUnderlineOffset: '.2em', textDecorationColor: primaryTextColor, color: 'var(--gray-12)', borderRadius: '.4em' };+export const highlightedTextStyle: CSSProperties = { textDecorationColor: primaryTextColor };-function HighlightedText({ children, style, ...props }: HTMLAttributes<HTMLSpanElement>) {+function HighlightedText({ children, style, ...props }: HTMLAttributes<HTMLButtonElement>) {// eslint-disable-next-line react/jsx-props-no-spreading- return <span {...props} style={{ ...highlightedTextStyle, ...style }}>{children}</span>;+ return <button type="button" {...props} className={styles['button']} style={{ ...highlightedTextStyle, ...style }}>{children}</button>;}export default memo(HighlightedText);