Skip to content

Commit

Permalink
Fix the editor content region focus style when scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Oct 27, 2017
1 parent ebb6864 commit 5b05c5d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
3 changes: 2 additions & 1 deletion editor/layout/index.js
Expand Up @@ -8,6 +8,7 @@ import classnames from 'classnames';
* WordPress dependencies
*/
import { NoticeList, Popover, navigateRegions } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -40,7 +41,7 @@ function Layout( { mode, isSidebarOpened, notices, ...props } ) {
<UnsavedChangesWarning />
<AutosaveMonitor />
<Header />
<div className="editor-layout__content">
<div className="editor-layout__content" role="region" aria-label={ __( 'Editor content' ) } tabIndex="-1">
<div className="editor-layout__editor">
{ mode === 'text' && <TextEditor /> }
{ mode === 'visual' && <VisualEditor /> }
Expand Down
1 change: 1 addition & 0 deletions editor/layout/style.scss
Expand Up @@ -8,6 +8,7 @@
}

.editor-layout__content {
position: relative;
display: flex;
flex-direction: column;
}
Expand Down
8 changes: 1 addition & 7 deletions editor/modes/text-editor/index.js
Expand Up @@ -7,7 +7,6 @@ import Textarea from 'react-autosize-textarea';
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { parse } from '@wordpress/blocks';

Expand Down Expand Up @@ -50,12 +49,7 @@ class TextEditor extends Component {
const { value } = this.props;

return (
<div
role="region"
aria-label={ __( 'Editor content' ) }
className="editor-text-editor"
tabIndex="-1"
>
<div className="editor-text-editor">
<div className="editor-text-editor__formatting">
<div className="editor-text-editor__formatting-group">
<button className="editor-text-editor__bold">b</button>
Expand Down
8 changes: 2 additions & 6 deletions editor/modes/visual-editor/index.js
Expand Up @@ -7,7 +7,6 @@ import { first, last } from 'lodash';
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { Component, findDOMNode } from '@wordpress/element';
import { KeyboardShortcuts } from '@wordpress/components';

Expand Down Expand Up @@ -79,16 +78,13 @@ class VisualEditor extends Component {

render() {
// Disable reason: Clicking the canvas should clear the selection
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/no-static-element-interactions */
return (
<div
role="region"
aria-label={ __( 'Editor content' ) }
className="editor-visual-editor"
onMouseDown={ this.onClick }
onTouchStart={ this.onClick }
ref={ this.bindContainer }
tabIndex="-1"
>
<KeyboardShortcuts shortcuts={ {
'mod+a': this.selectAll,
Expand All @@ -105,7 +101,7 @@ class VisualEditor extends Component {
<TableOfContents />
</div>
);
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/onclick-has-role, jsx-a11y/click-events-have-key-events */
/* eslint-enable jsx-a11y/no-static-element-interactions */
}
}

Expand Down

0 comments on commit 5b05c5d

Please sign in to comment.