diff --git a/src/oceans/components/common/Guide.jsx b/src/oceans/components/common/Guide.jsx index cc1f342c..445e1852 100644 --- a/src/oceans/components/common/Guide.jsx +++ b/src/oceans/components/common/Guide.jsx @@ -42,7 +42,7 @@ let UnwrappedGuide = class Guide extends React.Component { this.guideDialogRef && this.guideDialogRef.current ) { - this.guideDialogRef.current.focus(); + this.guideDialogRef.current.focus({focusVisible: false}); this.lastFocusedGuideId = currentGuideId; } else if (!currentGuide) { this.lastFocusedGuideId = null; @@ -53,7 +53,7 @@ let UnwrappedGuide = class Guide extends React.Component { setState({guideShowing: true, guideTypingTimer: undefined}); } - onGuideKeyDown = (e) => { + onGuideKeyDown = e => { if (e.key === ' ' || e.key === 'Enter' || e.key === 'Spacebar') { e.preventDefault(); this.onGuideClick(); @@ -74,14 +74,18 @@ let UnwrappedGuide = class Guide extends React.Component { {skipCallback: true} ); } else { - // This click did not start text to speech, so attempt - // to dismiss the guide. - const dismissed = guide.dismissCurrentGuide(); - if (dismissed) { - if (state.textToSpeechLocale) { - stopTextToSpeech(); + // Make sure we don't try and dismiss a guide if it's + // not modal. + if (currentGuide && !currentGuide.noDimBackground) { + // This click did not start text to speech, so attempt + // to dismiss the guide. + const dismissed = guide.dismissCurrentGuide(); + if (dismissed) { + if (state.textToSpeechLocale) { + stopTextToSpeech(); + } + soundLibrary.playSound('other'); } - soundLibrary.playSound('other'); } } }; @@ -101,10 +105,7 @@ let UnwrappedGuide = class Guide extends React.Component { // Do nothing if there is no current guide, or if we've already started // text to speech for the current guide (which might have finished // playing by now). - if ( - !currentGuide || - state.textToSpeechCurrentGuide === currentGuide - ) { + if (!currentGuide || state.textToSpeechCurrentGuide === currentGuide) { return false; } @@ -183,14 +184,9 @@ let UnwrappedGuide = class Guide extends React.Component { key={currentGuide.id} style={guideBgStyle} onClick={this.onGuideClick} - onKeyDown={this.onGuideKeyDown} - tabIndex={0} - role="button" - aria-label={I18n.t('continue')} id="uitest-dismiss-guide" >
)} - - {/* Visually hidden aria-live region for screen readers */} -
- {currentGuide.textFn(getState())} -
{/* Visible Typist animation for sighted users */}