Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADA-1629: Player v7 | Transcript | "Go to result" button background color doesn't match figma. #238

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/components/caption/caption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ export class Caption extends Component<ExtendedCaptionProps> {
this._captionRef?.focus();
}
});

eventManager?.listen(player, TranscriptEvents.TRANSCRIPT_SCROLLING, () => {
if(this._hasSearchMatch()) {
this._captionRef?.scrollIntoView()
}
})
}

shouldComponentUpdate(nextProps: ExtendedCaptionProps) {
Expand Down
3 changes: 3 additions & 0 deletions src/components/transcript/transcript.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ $button-height: 32px;
&:focus {
opacity: 1;
}
&[class^="Button__button"]:focus:not([class^="Button__disabled"]) {
background-color: $tone-5-color
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/components/transcript/transcript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export interface TranscriptProps {
isMobile?: boolean;
playerWidth?: number;
onJumpToSearchMatch: () => void;
onScrollToSearchMatch: () => void;
focusPluginButton: (event: KeyboardEvent) => void;
textTracks: Array<core.TextTrack>;
changeLanguage: (textTrack: core.TextTrack) => void;
Expand Down Expand Up @@ -223,6 +224,7 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {

private _onSearch = (search: string) => {
this.setState({search});
this.props.onScrollToSearchMatch()
};

private _findSearchMatches = () => {
Expand Down
1 change: 1 addition & 0 deletions src/events/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const TranscriptEvents = {
TRANSCRIPT_POPOUT_CLOSE: 'transcript_popout_close',
TRANSCRIPT_POPOUT_DRAG: 'transcript_popout_drag',
TRANSCRIPT_POPOUT_RESIZE: 'transcript_popout_resize',
TRANSCRIPT_SCROLLING: 'transcript_scrolling',

TRANSCRIPT_TO_SEARCH_MATCH: 'transcript_to_search_match' // internal event
};
Expand Down
5 changes: 5 additions & 0 deletions src/transcript-plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
this.dispatchEvent(TranscriptEvents.TRANSCRIPT_TO_SEARCH_MATCH);
};

private _scrollToMatch = () => {
this.dispatchEvent(TranscriptEvents.TRANSCRIPT_SCROLLING);
}

private _changeLanguage = (textTrack: core.TextTrack) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error - Property 'selectTrack' does not exist on type 'Player'
Expand Down Expand Up @@ -340,6 +344,7 @@ export class TranscriptPlugin extends KalturaPlayer.core.BasePlugin {
this._handleAttach(CloseDetachTypes.arrow);
}}
onJumpToSearchMatch={this._toSearchMatch}
onScrollToSearchMatch={this._scrollToMatch}
//@ts-ignore
focusPluginButton={(event: KeyboardEvent) => this.upperBarManager!.focusPluginButton(this._transcriptIcon, event)}
textTracks={this._getTextTracks()}
Expand Down
Loading