diff --git a/package.json b/package.json index 2dc63db9c60..988e9cf2d57 100644 --- a/package.json +++ b/package.json @@ -233,7 +233,9 @@ "optionalDependencies": { "inspect-process": "^0.5" }, - "browserslist": ["extends @instructure/browserslist-config-canvas-lms"], + "browserslist": [ + "extends @instructure/browserslist-config-canvas-lms" + ], "jest-junit": { "output": "./coverage-js/junit-reports/jest.xml" }, diff --git a/packages/canvas-rce/src/rce/RCEWrapper.js b/packages/canvas-rce/src/rce/RCEWrapper.js index 706e6ba5c37..a2a64ad3a37 100644 --- a/packages/canvas-rce/src/rce/RCEWrapper.js +++ b/packages/canvas-rce/src/rce/RCEWrapper.js @@ -137,6 +137,7 @@ class RCEWrapper extends React.Component { this.indicator = false; this._elementRef = null; + this._showOnFocusButton = null; injectTinySkin() @@ -278,14 +279,14 @@ class RCEWrapper extends React.Component { return editors.filter(ed => ed.id === this.props.textareaId)[0]; } - onTinyMCEInstance(command) { - if (command == "mceRemoveEditor") { - let editor = this.mceInstance(); - if (editor) { + onTinyMCEInstance(command, args) { + const editor = this.mceInstance(); + if (editor) { + if (command == "mceRemoveEditor") { editor.execCommand("mceNewDocument"); } // makes sure content can't persist past removal + editor.execCommand(command, false, this.props.textareaId, args); } - this.props.tinymce.execCommand(command, false, this.props.textareaId); } destroy() { @@ -552,7 +553,7 @@ class RCEWrapper extends React.Component { } onA11yChecker = () => { - this.onTinyMCEInstance('openAccessibilityChecker', {'data-canvas-component': true}) + this.onTinyMCEInstance('openAccessibilityChecker', {skip_focus: true}) } handleShortcutKeyShortcut = (event) => { @@ -572,8 +573,10 @@ class RCEWrapper extends React.Component { } KBShortcutModalClosed = () => { - if(Bridge.activeEditor() === this) { - Bridge.focusActiveEditor(false) + // when the modal is opened from the showOnFocus button, focus doesn't + // get automatically returned to the button like it should. + if (this._showOnFocusButton && document.activeElement === document.body) { + this._showOnFocusButton.focus() } } @@ -710,6 +713,7 @@ class RCEWrapper extends React.Component { icon: IconKeyboardShortcutsLine, margin: 'xx-small' }} + ref={el => this._showOnFocusButton = el} > {{formatMessage('View keyboard shortcuts')}} diff --git a/packages/canvas-rce/src/rce/StatusBar.js b/packages/canvas-rce/src/rce/StatusBar.js index 2de2c480a51..71ca273592f 100644 --- a/packages/canvas-rce/src/rce/StatusBar.js +++ b/packages/canvas-rce/src/rce/StatusBar.js @@ -111,7 +111,7 @@ export default function StatusBar(props) { > {kbshortcut} -