-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
This reverts commit d10fda5.
src/components/language/language.js
Outdated
} | ||
}} | ||
className={style.smartContainerItem} | ||
onSelect={props.onSelect}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if needed (onSelect)
src/components/menu/menu.js
Outdated
setFirstFocusedElement={props.setFirstFocusedElement} | ||
addAccessibleChild={props.addAccessibleChild} | ||
isSelected={this.isSelected} | ||
onSelect={this.onSelect.bind(this)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to arrow function
src/components/menu/menu.js
Outdated
ref={se => { | ||
this._selectedElement = props.isSelected(props.data) ? se : this._selectedElement; | ||
props.setFirstFocusedElement(this._selectedElement); | ||
if (!this._mounted) { |
There was a problem hiding this comment.
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
src/ui-presets/playback.js
Outdated
@@ -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} /> |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use jsx
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
src/components/dropdown/dropdown.js
Outdated
@@ -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} |
There was a problem hiding this comment.
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
?
src/components/menu/menu.js
Outdated
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}`}> |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #410
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix the desc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see now
There was a problem hiding this comment.
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 toComponent
(and remove/add the proper import)
this is for the whole PR (I see 18 appearances ofBaseComponent
here)
_element: ?HTMLElement; | ||
|
||
/** | ||
* after component mounted, listen to events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix what? :)
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
html attributes are strings
src/components/cast/cast.js
Outdated
}, | ||
h('google-cast-launcher', { | ||
class: style.castButton | ||
class: [style.castButton].join(' '), | ||
tabIndex: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my question above
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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}> |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 toComponent
(and remove/add the proper import)
this is for the whole PR (I see 18 appearances ofBaseComponent
here)
_element: ?HTMLElement; | ||
|
||
/** | ||
* after component mounted, listen to events |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check to remove
0317984
to
e4a47c5
Compare
User should be able to navigate menus using the TAB and the UP/DOWN arrows