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

fix(FEC-14080): Accessibility fix for the top bar and the bottom bar #925

Merged
merged 8 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
23 changes: 22 additions & 1 deletion src/components/bottom-bar/_bottom-bar.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.player .bottom-bar {
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 100%);
color: #fff;
height: auto;
width: 100%;
Expand Down Expand Up @@ -91,6 +90,21 @@
.player.ad-break,
.player.menu-active {
&:not(.overlay-active) {
:global(.playkit-video-filter) {
&:after {
position: absolute;
bottom: 0;
left: 0;

lianbenjamin marked this conversation as resolved.
Show resolved Hide resolved
width: 100%;
height: 50%;
max-height: 200px;
opacity: 1;
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 100%);
content: "";
}
}

.bottom-bar {
position: relative;
opacity: 1;
Expand Down Expand Up @@ -125,3 +139,10 @@
}
}
}

:global(.playkit-video-filter) {
&:after {
transition: #{$hover-animation-time}ms opacity ease-in-out;
opacity: 0;
}
}
28 changes: 16 additions & 12 deletions src/components/bottom-bar/bottom-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {withPlayer} from '../player';
import {calculateControlsSize, filterControlsByPriority} from './bettom-bar-utils';
import {BottomBarRegistryManager, bottomBarRegistryManager} from './bottom-bar-registry-manager';


const LOWER_PRIORITY_CONTROLS: string[][] = [
['PictureInPicture'],
['VrStereo'],
Expand Down Expand Up @@ -53,10 +52,10 @@ const COMPONENT_NAME = 'BottomBar';
@withEventManager
@connect(mapStateToProps, bindActions({...actions, ...bottomBarActions}))
class BottomBar extends Component<any, any> {
bottomBarContainerRef: RefObject<HTMLDivElement> = createRef<HTMLDivElement>();
presetControls: {[controlName: string]: boolean} = {};
currentBarWidth: number = 0;
resizeObserver!: ResizeObserver;
private bottomBarContainerRef: RefObject<HTMLDivElement> = createRef<HTMLDivElement>();
private presetControls: {[controlName: string]: boolean} = {};
private currentBarWidth: number = 0;
private resizeObserver!: ResizeObserver;

// eslint-disable-next-line require-jsdoc
constructor(props: any) {
Expand All @@ -78,18 +77,18 @@ class BottomBar extends Component<any, any> {
* @returns {void}
* @memberof BottomBar
*/
componentDidMount(): void {
public componentDidMount(): void {
MosheMaorKaltura marked this conversation as resolved.
Show resolved Hide resolved
this.resizeObserver = new ResizeObserver((entry: ResizeObserverEntry[]) => this.onBarWidthChange(entry));
this.resizeObserver.observe(this.bottomBarContainerRef.current!);
}

// eslint-disable-next-line require-jsdoc
componentWillUnmount(): void {
public componentWillUnmount(): void {
this.resizeObserver.disconnect();
}

// eslint-disable-next-line require-jsdoc
onBarWidthChange(entry: ResizeObserverEntry[]): void {
private onBarWidthChange(entry: ResizeObserverEntry[]): void {
const barWidth = entry[0].contentRect.width;
if (barWidth !== this.currentBarWidth) {
const activeControls = Object.keys(this.state.activeControls).filter(c => this.state.activeControls[c]);
Expand All @@ -101,14 +100,19 @@ class BottomBar extends Component<any, any> {
}
}

onToggleControl = (controlName: string, isActive: boolean): void => {
private onToggleControl = (controlName: string, isActive: boolean): void => {
if (controlName in this.state.activeControls && this.state.activeControls[controlName] !== isActive) {
this.setState(state => ({activeControls: {...state.activeControls, ...{[controlName]: isActive}}}));
}
};

// eslint-disable-next-line require-jsdoc
filterControls(currentBarWidth: number, currentMinBreakPointWidth: number, currentControlWidth: number, lowerPriorityControls: string[][]): void {
private filterControls(
currentBarWidth: number,
currentMinBreakPointWidth: number,
currentControlWidth: number,
lowerPriorityControls: string[][]
): void {
// move up
const isBreak = currentMinBreakPointWidth >= currentBarWidth;
if (isBreak) {
Expand All @@ -130,7 +134,7 @@ class BottomBar extends Component<any, any> {
* @returns {?React$Element} - component element
* @memberof BottomBar
*/
render(props: any) {
public render(props: any) {
const styleClass = [style.bottomBar];
if (props.isCasting && props.isPlaybackEnded) {
styleClass.push(style.hide);
Expand All @@ -141,7 +145,7 @@ class BottomBar extends Component<any, any> {
<div className={styleClass.join(' ')}>
<div className={style.bottomBarArea}>
<PlayerArea shouldUpdate={true} name={'BottomBar'}>
{shouldRenderTimeDisplay && <TimeDisplayPlaybackContainer/>}
{shouldRenderTimeDisplay && <TimeDisplayPlaybackContainer />}
{props.children}
</PlayerArea>
</div>
Expand Down
24 changes: 23 additions & 1 deletion src/components/top-bar/_top-bar.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.player .top-bar {
background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
// background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
lianbenjamin marked this conversation as resolved.
Show resolved Hide resolved
color: #fff;
visibility: hidden;
position: relative;
Expand Down Expand Up @@ -73,6 +73,21 @@
.player.ad-break,
.player.menu-active {
&:not(.overlay-active) {
:global(.playkit-video-filter) {
&:before {
position: absolute;
SivanA-Kaltura marked this conversation as resolved.
Show resolved Hide resolved
top: 0;
left: 0;

width: 100%;
height: 50%;
max-height: 200px;
opacity: 1;
background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
content: "";
}
}

.top-bar {
visibility: visible;
margin-top: 0;
Expand Down Expand Up @@ -119,3 +134,10 @@
}
}
}

:global(.playkit-video-filter) {
&:before {
transition: #{$hover-animation-time}ms opacity ease-in-out;
opacity: 0;
}
}
Loading