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

feat(FEC-7551): handling keyboard a11y #409

Merged
merged 30 commits into from
Sep 26, 2019
Merged

feat(FEC-7551): handling keyboard a11y #409

merged 30 commits into from
Sep 26, 2019

Conversation

RoyBregman
Copy link
Contributor

User should be able to navigate menus using the TAB and the UP/DOWN arrows

}
}}
className={style.smartContainerItem}
onSelect={props.onSelect}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if needed (onSelect)

setFirstFocusedElement={props.setFirstFocusedElement}
addAccessibleChild={props.addAccessibleChild}
isSelected={this.isSelected}
onSelect={this.onSelect.bind(this)}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to arrow function

ref={se => {
this._selectedElement = props.isSelected(props.data) ? se : this._selectedElement;
props.setFirstFocusedElement(this._selectedElement);
if (!this._mounted) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check for better pattern to add it only onMount

@@ -41,6 +41,7 @@ export function playbackUI(props: any): React$Element<any> {
<div className={style.playbackGuiWWrapper}>
<KeyboardControl player={props.player} config={props.config} />
<Loading player={props.player} />
<PictureInPictureOverlay player={props.player} />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if it better inside player gui

*/
render(props: any): React$Element<any> | void {
return h(
'div',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use jsx

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see example here #410

<Overlay open onClose={() => props.onClose()} type="cvaa">
{this.state.activeWindow === cvaaOverlayState.Main ? (
<KeyboardAccessibleMainWindow
tabbable="true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be true? or just tabbable

@@ -138,10 +143,15 @@ class DropDown extends Component {
className={this.state.dropMenuActive ? [style.dropdown, style.active].join(' ') : style.dropdown}
ref={el => (this._el = el)}>
<div
tabIndex="0"
ref={el => (this._dropdownButton = el)}
tabIndex={props.tabbable ? '0' : -1}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabIndex is string or number?

className={props.isSelected(props.data) ? [style.dropdownMenuItem, style.active].join(' ') : style.dropdownMenuItem}
onClick={() => this.onSelect(props)}>
<span>{props.data.label}</span>
<span className={style.menuIconContainer} style={`opacity: ${props.isSelected(props.data) ? 1 : 0}`}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handle the opacity by class

}

export {SmartContainer};
const keyboardAccessibleSmartContainer = popupWithKeyboardA11y(SmartContainer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't use @with... pattern here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not familiar with @with...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #410

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AMAZING!!!! done


/**
* @param {BaseComponent} WrappedComponent - The popup item component to implement keyboard accessibility
* @returns {BaseComponent} - HOC that handles animation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix the desc


/**
* @param {BaseComponent} WrappedComponent - The popup component to implement keyboard accessibility
* @returns {BaseComponent} - HOC that handles animation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix the desc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • HOC that handles animation ?
  • In addition in the Oren's change (feat(FEC-9341): refactor base component to HoC #410) there is no BaseComponent any more. change it to Component (and remove/add the proper import)
    this is for the whole PR (I see 18 appearances of BaseComponent here)

_element: ?HTMLElement;

/**
* after component mounted, listen to events
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix what? :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the jsdoc. you don't listen to events here

<a className={[style.btn, style.btnDarkTransparent, style.castOnTvButton].join(' ')}>
<div className={rootStyle.join(' ')}>
<a
tabIndex="0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabIndex is string or number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

html attributes are strings

},
h('google-cast-launcher', {
class: style.castButton
class: [style.castButton].join(' '),
tabIndex: 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my question above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored entire code to jsx

}

export {SmartContainer};
const keyboardAccessibleSmartContainer = popupWithKeyboardA11y(SmartContainer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #410

*/
render(props: any): React$Element<any> | void {
return h(
'div',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see example here #410

<div className={rootStyle.join(' ')} onClick={() => this.onClick()}>
<a className={[style.btn, style.btnDarkTransparent, style.castOnTvButton].join(' ')}>
<div className={rootStyle.join(' ')}>
<a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is a button why not use a button?
Also add aria label

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

{this.renderMainState()}
{this.renderCustomCaptionsState(props)}
</Overlay>
<div className={props.state.activeWindow === cvaaOverlayState.Main ? [style.overlayScreen, style.active].join(' ') : style.overlayScreen}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this as you handle it in render already

* @class MainWindow
* @extends {Component}
*/
class MainWindow extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be a Function component

* @class CustomCaptionsWindow
* @extends {Component}
*/
class CustomCaptionsWindow extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be a Function component

<div className={this.state.state === cvaaOverlayState.CustomCaptions ? [style.overlayScreen, style.active].join(' ') : style.overlayScreen}>
<div
className={
props.state.activeWindow === cvaaOverlayState.CustomCaptions ? [style.overlayScreen, style.active].join(' ') : style.overlayScreen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this, you handle it in render already
Also check if there are non used CSS rules/classes now


/**
* @param {BaseComponent} WrappedComponent - The popup component to implement keyboard accessibility
* @returns {BaseComponent} - HOC that handles animation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • HOC that handles animation ?
  • In addition in the Oren's change (feat(FEC-9341): refactor base component to HoC #410) there is no BaseComponent any more. change it to Component (and remove/add the proper import)
    this is for the whole PR (I see 18 appearances of BaseComponent here)

_element: ?HTMLElement;

/**
* after component mounted, listen to events
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the jsdoc. you don't listen to events here

# Conflicts:
#	src/components/cast-on-tv/cast-before-play.js
#	src/components/cast/cast.js
#	src/components/cvaa-overlay/cvaa-overlay.js
#	src/components/language/language.js
#	src/components/playlist-next-screen/playlist-next-screen.js
#	src/components/settings/settings.js
#	src/ui-presets/playback.js
<div tabIndex="-1" className={[style.smartContainer, style.top, style.left].join(' ')}>
<div
onKeyDown={e => {
props.handleKeyDown(e);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check to remove

@RoyBregman RoyBregman marked this pull request as ready for review September 26, 2019 11:20
@yairans yairans merged commit 53698a5 into master Sep 26, 2019
@yairans yairans deleted the FEC-7551-a11y-hoc branch September 26, 2019 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants