@@ -11,7 +11,7 @@ import {
1111 useSearchCounts
1212} from '@Services/search' ;
1313import { useTranscripts } from '@Services/ramp-hooks' ;
14- import { autoScroll , timeToHHmmss } from '@Services/utility-helpers' ;
14+ import { autoScroll , screenReaderFriendlyTime , timeToHHmmss } from '@Services/utility-helpers' ;
1515import Spinner from '@Components/Spinner' ;
1616import './Transcript.scss' ;
1717
@@ -129,27 +129,30 @@ const TranscriptLine = memo(({
129129 * @returns
130130 */
131131 const handleKeyDown = ( e ) => {
132- if ( e . key === 'Enter' || e . key === 'Space' ) {
132+ if ( e . keyCode == 13 || e . keyCode == 32 ) {
133133 onClick ( e ) ;
134134 } else {
135135 return ;
136136 }
137137 } ;
138138
139+ const cueText = useMemo ( ( ) => {
140+ return buildSpeakerText ( item , item . tag === TRANSCRIPT_CUE_TYPES . nonTimedLine ) ;
141+ } , [ item ?. tag ] ) ;
142+
139143 /** Build text portion of the transcript cue element */
140144 const cueTextElement = useMemo ( ( ) => {
141- const text = buildSpeakerText ( item , item . tag === TRANSCRIPT_CUE_TYPES . nonTimedLine ) ;
142145 switch ( item . tag ) {
143146 case TRANSCRIPT_CUE_TYPES . note :
144- return showNotes ? < span dangerouslySetInnerHTML = { { __html : text } } /> : null ;
147+ return showNotes ? < span dangerouslySetInnerHTML = { { __html : cueText } } /> : null ;
145148 case TRANSCRIPT_CUE_TYPES . timedCue :
146- return < span className = "ramp--transcript_text" data-testid = "transcript_text" dangerouslySetInnerHTML = { { __html : text } } /> ;
149+ return < span className = "ramp--transcript_text" data-testid = "transcript_text" dangerouslySetInnerHTML = { { __html : cueText } } /> ;
147150 case TRANSCRIPT_CUE_TYPES . nonTimedLine :
148- return < p className = "ramp--transcript_untimed_item" dangerouslySetInnerHTML = { { __html : text } } /> ;
151+ return < p className = "ramp--transcript_untimed_item" dangerouslySetInnerHTML = { { __html : cueText } } /> ;
149152 default :
150153 return null ;
151154 }
152- } , [ item , showNotes ] ) ;
155+ } , [ cueText , showNotes ] ) ;
153156
154157 const testId = useMemo ( ( ) => {
155158 switch ( item . tag ) {
@@ -168,8 +171,9 @@ const TranscriptLine = memo(({
168171
169172 return (
170173 < span
171- role = "button "
174+ role = "radio "
172175 tabIndex = { isFirstItem ? 0 : - 1 }
176+ aria-checked = { isActive }
173177 ref = { itemRef }
174178 onClick = { onClick }
175179 onKeyDown = { handleKeyDown }
@@ -179,6 +183,7 @@ const TranscriptLine = memo(({
179183 isFocused && 'focused'
180184 ) }
181185 data-testid = { testId }
186+ aria-label = { `${ screenReaderFriendlyTime ( item . begin ) } , ${ cueText } ` }
182187 >
183188 { item . tag === TRANSCRIPT_CUE_TYPES . timedCue && typeof item . begin === 'number' && (
184189 < span className = "ramp--transcript_time" data-testid = "transcript_time" >
@@ -287,7 +292,7 @@ const TranscriptList = memo(({
287292 return (
288293 < div
289294 data-testid = { `transcript_${ testId } ` }
290- role = "list "
295+ role = "radiogroup "
291296 onKeyDown = { handleKeyDown }
292297 ref = { transcriptListRef }
293298 aria-label = 'Scrollable transcript cues'
0 commit comments