Skip to content

Commit

Permalink
fix(ADA-1774): University of Illinois Urbana-Champaign (ADA) V7 playe… (
Browse files Browse the repository at this point in the history
#230)

…r issues Priority SS (#5) Transcript - transcript panel acts as a keyboard trap for users who utilize the keyboard to interact

Adding functionality to close transcript panel with Escape key.

Solves ADA-1774
  • Loading branch information
Tzipi-kaltura authored Dec 9, 2024
1 parent 2397add commit 803447e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/transcript/transcript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {ScreenReaderProvider} from '@playkit-js/common/dist/hoc/sr-wrapper';
import {OnClickEvent, OnClick} from '@playkit-js/common/dist/hoc/a11y-wrapper';
import {TranscriptEvents} from '../../events/events';

const {ENTER, SPACE, TAB} = ui.utils.KeyMap;
const {ENTER, SPACE, TAB, ESC} = ui.utils.KeyMap;
const {withText, Text} = ui.preacti18n;

const {SidePanelModes} = ui;
Expand Down Expand Up @@ -166,6 +166,12 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
}
}

private _handleClose = (event: KeyboardEvent) => {
if (event.keyCode === ESC){
this.props.onClose(event, true);
}
};

private _enableAutoScroll = (event: OnClickEvent, byKeyboard?: boolean) => {
event.preventDefault();
if (this.state.isAutoScrollEnabled) {
Expand Down Expand Up @@ -512,6 +518,7 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
ref={node => {
this._widgetRootRef = node;
}}
onKeyUp={this._handleClose}
data-testid="transcript_root">
{smallScreen && !kitchenSinkDetached ? (
<SmallScreenSlate onClose={this.props.onClose} toggledWithEnter={toggledWithEnter} />
Expand Down

0 comments on commit 803447e

Please sign in to comment.