fix: remaining time tabindex

This commit is contained in:
kKaskak 2024-03-25 20:29:04 +02:00
parent 0604c6b894
commit 65edf59d17
2 changed files with 4 additions and 3 deletions

View file

@ -6,7 +6,7 @@ const classnames = require('classnames');
const styles = require('./styles');
const { useLongPress } = require('use-long-press');
const Button = React.forwardRef(({ className, href, disabled, children, onLongPress, ...props }, ref) => {
const Button = React.forwardRef(({ className, href, disabled, children, onLongPress, tabIndex, ...props }, ref) => {
const longPress = useLongPress(onLongPress, { detect: 'pointer' });
const onKeyDown = React.useCallback((event) => {
if (typeof props.onKeyDown === 'function') {
@ -35,7 +35,7 @@ const Button = React.forwardRef(({ className, href, disabled, children, onLongPr
return React.createElement(
typeof href === 'string' && href.length > 0 ? 'a' : 'div',
{
tabIndex: 0,
tabIndex: tabIndex ?? 0,
...props,
ref,
className: classnames(className, styles['button-container'], { 'disabled': disabled }),
@ -53,6 +53,7 @@ Button.displayName = 'Button';
Button.propTypes = {
className: PropTypes.string,
href: PropTypes.string,
tabIndex: PropTypes.number,
disabled: PropTypes.bool,
children: PropTypes.node,
onKeyDown: PropTypes.func,

View file

@ -58,7 +58,7 @@ const SeekBar = ({ className, time, duration, buffered, onSeekRequested }) => {
onSlide={onSlide}
onComplete={onComplete}
/>
<Button onClick={toggleRemainingTimeMode}>
<Button onClick={toggleRemainingTimeMode} tabIndex={-1}>
<div className={styles['label']}>
{remainingTimeMode && duration !== null && !isNaN(duration)
? formatTime(duration - time, '-')