improve screen reader panel check

This commit is contained in:
KDSBrowne 2019-05-15 21:13:05 +00:00
parent e9f02a64e8
commit 475e945abc
2 changed files with 8 additions and 40 deletions

View File

@ -54,8 +54,6 @@ const propTypes = {
media: PropTypes.element, media: PropTypes.element,
actionsbar: PropTypes.element, actionsbar: PropTypes.element,
closedCaption: PropTypes.element, closedCaption: PropTypes.element,
userListIsOpen: PropTypes.bool.isRequired,
chatIsOpen: PropTypes.bool.isRequired,
locale: PropTypes.string, locale: PropTypes.string,
intl: intlShape.isRequired, intl: intlShape.isRequired,
}; };
@ -81,6 +79,7 @@ class App extends Component {
}; };
this.handleWindowResize = throttle(this.handleWindowResize).bind(this); this.handleWindowResize = throttle(this.handleWindowResize).bind(this);
this.enableSRTrap = this.enableSRTrap.bind(this);
} }
componentDidMount() { componentDidMount() {
@ -128,6 +127,11 @@ class App extends Component {
this.setState({ enableResize: shouldEnableResize }); this.setState({ enableResize: shouldEnableResize });
} }
enableSRTrap() {
const { openPanel, isPhone } = this.props;
return openPanel !== '' && (isPhone || isLayeredView.matches);
}
renderPanel() { renderPanel() {
const { enableResize } = this.state; const { enableResize } = this.state;
const { openPanel } = this.props; const { openPanel } = this.props;
@ -182,30 +186,15 @@ class App extends Component {
const { const {
media, media,
intl, intl,
chatIsOpen,
userListIsOpen,
isPhone,
breakoutRoomIsOpen,
pollIsOpen,
waitingUsersIsOpen,
notesIsOpen,
} = this.props; } = this.props;
const enableScreenReaderTrap = (isPhone || isLayeredView.matches)
&& (userListIsOpen
|| chatIsOpen
|| breakoutRoomIsOpen
|| pollIsOpen
|| notesIsOpen
|| waitingUsersIsOpen);
if (!media) return null; if (!media) return null;
return ( return (
<section <section
className={styles.media} className={styles.media}
aria-label={intl.formatMessage(intlMessages.mediaLabel)} aria-label={intl.formatMessage(intlMessages.mediaLabel)}
aria-hidden={enableScreenReaderTrap} aria-hidden={this.enableSRTrap()}
> >
{media} {media}
{this.renderClosedCaption()} {this.renderClosedCaption()}
@ -217,30 +206,15 @@ class App extends Component {
const { const {
actionsbar, actionsbar,
intl, intl,
userListIsOpen,
chatIsOpen,
isPhone,
breakoutRoomIsOpen,
pollIsOpen,
notesIsOpen,
waitingUsersIsOpen,
} = this.props; } = this.props;
const enableScreenReaderTrap = (isPhone || isLayeredView.matches)
&& (userListIsOpen
|| chatIsOpen
|| breakoutRoomIsOpen
|| pollIsOpen
|| notesIsOpen
|| waitingUsersIsOpen);
if (!actionsbar) return null; if (!actionsbar) return null;
return ( return (
<section <section
className={styles.actionsbar} className={styles.actionsbar}
aria-label={intl.formatMessage(intlMessages.actionsBarLabel)} aria-label={intl.formatMessage(intlMessages.actionsBarLabel)}
aria-hidden={enableScreenReaderTrap} aria-hidden={this.enableSRTrap()}
> >
{actionsbar} {actionsbar}
</section> </section>

View File

@ -95,13 +95,7 @@ export default injectIntl(withModalMounter(withTracker(({ intl, baseControls })
hasBreakoutRooms: getBreakoutRooms().length > 0, hasBreakoutRooms: getBreakoutRooms().length > 0,
customStyle: getFromUserSettings('customStyle', false), customStyle: getFromUserSettings('customStyle', false),
customStyleUrl: getFromUserSettings('customStyleUrl', false), customStyleUrl: getFromUserSettings('customStyleUrl', false),
breakoutRoomIsOpen: Session.equals('openPanel', 'breakoutroom'),
pollIsOpen: Session.equals('openPanel', 'poll'),
notesIsOpen: Session.equals('openPanel', 'note'),
waitingUsersIsOpen: Session.equals('openPanel', 'waitingUsersPanel'),
chatIsOpen: Session.equals('openPanel', 'chat'),
openPanel: Session.get('openPanel'), openPanel: Session.get('openPanel'),
userListIsOpen: !Session.equals('openPanel', ''),
UserInfo, UserInfo,
notify, notify,
validIOSVersion, validIOSVersion,