File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
apps/frontend/src/libs/components/player-track Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ type Properties = {
1818const PlayerTrack : React . FC < Properties > = ( { audioUrl } : Properties ) => {
1919 const audioReference = useRef < HTMLAudioElement > ( null ) ;
2020 const progressReference = useRef < HTMLButtonElement > ( null ) ;
21+ const playButtonReference = useRef < HTMLButtonElement > ( null ) ;
2122
2223 const [ isPlaying , setIsPlaying ] = useState < boolean > ( false ) ;
2324 const [ currentTime , setCurrentTime ] = useState < number > ( START_TIME ) ;
@@ -91,6 +92,7 @@ const PlayerTrack: React.FC<Properties> = ({ audioUrl }: Properties) => {
9192
9293 audioReference . current . currentTime = newTime ;
9394 setCurrentTime ( newTime ) ;
95+ playButtonReference . current ?. focus ( ) ;
9496 }
9597 } ,
9698 [ duration ] ,
@@ -122,7 +124,11 @@ const PlayerTrack: React.FC<Properties> = ({ audioUrl }: Properties) => {
122124
123125 return (
124126 < div className = { styles [ "root" ] } >
125- < button className = { styles [ "button" ] } onClick = { handleClick } >
127+ < button
128+ className = { styles [ "button" ] }
129+ onClick = { handleClick }
130+ ref = { playButtonReference }
131+ >
126132 < Icon className = { styles [ "icon" ] } name = { isPlaying ? "play" : "pause" } />
127133 < span className = "visually-hidden" >
128134 { isPlaying ? "Pause audio" : "Play audio" }
You can’t perform that action at this time.
0 commit comments