Skip to content

Commit

Permalink
more #335 work: shift-tab should move focus from block editor to tool…
Browse files Browse the repository at this point in the history
…bar input
  • Loading branch information
Emmanuel Schanzer committed Mar 2, 2021
1 parent 6cc7f62 commit 3679b67
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/keymap.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ CodeMirror.normalizeKeyMap(defaultKeyMap);

export const commandMap = {
prevFocus : function (_, e) {
console.log(this);
this.toggleButtonRef.current.focus();
this.toolbarRef.current.primitiveSearch.focus();
e.preventDefault();
},

prevNode : function (_, e) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/BlockEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ class BlockEditor extends Component {
handleTopLevelFocus = (ed, _) => {
const {dispatch} = this.props;
dispatch((_, getState) => {
const {cur} = getState();
const {cur, focusId} = getState();
if (!this.mouseUsed && (cur === null)) {
// NOTE(Oak): use setTimeout so that the CM cursor will not blink
setTimeout(() => this.props.activateByNid(null, {allowMove: true}), 0);
Expand Down
3 changes: 1 addition & 2 deletions src/ui/ToggleEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ export default @CMBContext class ToggleEditor extends React.Component {
<div className={classes}>
<ToggleButton
setBlockMode={this.handleToggle}
blockMode={this.state.blockMode}
ref={this.toggleButtonRef} />
blockMode={this.state.blockMode} />
{this.state.blockMode ? <TrashCan/> : null}
<div className={"col-xs-3 toolbar-pane"} tabIndex="-1" aria-hidden={!this.state.blockMode}>
<Toolbar
Expand Down
1 change: 1 addition & 0 deletions src/ui/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export default class Toolbar extends Component {
className="form-control"
value={this.state.search}
onKeyDown={this.handleKeyDown}
ref={(elt) => { this.primitiveSearch = elt; }}
onChange={this.changeSearch} />
{this.state.search ?
<button
Expand Down

0 comments on commit 3679b67

Please sign in to comment.