Can no longer move editor focus when editor is not code editor (fixes #2736)

This commit is contained in:
Benjamin Pasero
2016-02-05 16:06:53 +01:00
parent e80a78ba98
commit 8435ddcf46
5 changed files with 16 additions and 6 deletions
@@ -56,6 +56,7 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas
let leftBinaryContainerElement = document.createElement('div');
leftBinaryContainerElement.className = 'binary-container';
this.leftBinaryContainer = $(leftBinaryContainerElement);
this.leftBinaryContainer.tabindex(0); // enable focus support from the editor part (do not remove)
// Left Custom Scrollbars
this.leftScrollbar = new ScrollableElement(leftBinaryContainerElement, { horizontal: 'hidden', vertical: 'hidden' });
@@ -72,6 +73,7 @@ export class BinaryResourceDiffEditor extends BaseEditor implements IVerticalSas
let rightBinaryContainerElement = document.createElement('div');
rightBinaryContainerElement.className = 'binary-container';
this.rightBinaryContainer = $(rightBinaryContainerElement);
this.rightBinaryContainer.tabindex(0); // enable focus support from the editor part (do not remove)
// Right Custom Scrollbars
this.rightScrollbar = new ScrollableElement(rightBinaryContainerElement, { horizontal: 'hidden', vertical: 'hidden' });
@@ -40,6 +40,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
let binaryContainerElement = document.createElement('div');
binaryContainerElement.className = 'binary-container monaco-editor-background'; // Inherit the background color from selected theme'
this.binaryContainer = $(binaryContainerElement);
this.binaryContainer.tabindex(0); // enable focus support from the editor part (do not remove)
parent.getHTMLElement().appendChild(this.binaryContainer.getHTMLElement());
}
@@ -52,6 +52,7 @@ export class IFrameEditor extends BaseEditor {
let iframeContainerElement = document.createElement('div');
iframeContainerElement.className = 'iframe-container monaco-editor-background'; // Inherit the background color from selected theme
this.iframeContainer = $(iframeContainerElement);
this.iframeContainer.tabindex(0); // enable focus support from the editor part (do not remove)
// IFrame
this.iframeBuilder = $(this.iframeContainer).element('iframe').addClass('iframe');
@@ -132,7 +132,7 @@
}
.monaco-shell .monaco-tree.focused:focus {
outline: 0; /* tree indicates focus not via outline but through the focussed item */
outline: 0 !important; /* tree indicates focus not via outline but through the focussed item */
}
.monaco-shell [tabindex="0"]:active,
@@ -145,7 +145,12 @@
}
.monaco-shell .activitybar [tabindex="0"]:focus {
outline: 0; /* activity bar indicates focus custom */
outline: 0 !important; /* activity bar indicates focus custom */
}
.monaco-shell .part.editor .iframe-container,
.monaco-shell .part.editor .binary-container {
outline: 0 !important; /* TODO@Ben we need focus indication for those too */
}
/* END Keyboard Focus Indication Styles */
@@ -72,6 +72,7 @@ export class HtmlPreviewPart extends BaseEditor {
// Container for IFrame
const iFrameContainerElement = document.createElement('div');
iFrameContainerElement.className = 'iframe-container monaco-editor-background'; // Inherit the background color from selected theme
iFrameContainerElement.tabIndex = 0; // enable focus support from the editor part (do not remove)
iFrameContainerElement.appendChild(this._iFrameElement);
parent.getHTMLElement().appendChild(iFrameContainerElement);
@@ -113,7 +114,7 @@ export class HtmlPreviewPart extends BaseEditor {
} else {
this._modelChangeUnbind = cAll(this._modelChangeUnbind);
}
})
});
}
public changePosition(position: Position): void {
@@ -139,7 +140,7 @@ export class HtmlPreviewPart extends BaseEditor {
return this._editorService.resolveEditorModel({ resource: (<HtmlInput>input).getResource() }).then(model => {
if (model instanceof BaseTextEditorModel) {
this._model = model.textEditorModel
this._model = model.textEditorModel;
}
if (!this._model) {
@@ -183,7 +184,7 @@ export class HtmlPreviewPart extends BaseEditor {
if (newDocument.head.hasChildNodes()) {
newDocument.head.insertBefore(styleElement, newDocument.head.firstChild);
} else {
newDocument.head.appendChild(styleElement)
newDocument.head.appendChild(styleElement);
}
if (newDocument.head.innerHTML !== iFrameDocument.head.innerHTML) {
@@ -296,7 +297,7 @@ namespace Integration {
'::-webkit-scrollbar-thumb:active {',
' background-color: rgba(85, 85, 85, 0.8);',
'}'
].join('\n')
].join('\n');
export function defaultStyle(element: HTMLElement, themeId: string): HTMLStyleElement {
const styles = window.getComputedStyle(element);