提交 4347674e 编写于 作者: A Alex Dima

Fixes Microsoft/monaco-editor#425: Create an aria container dom node as soon...

Fixes Microsoft/monaco-editor#425: Create an aria container dom node as soon as the first editor is instantiated
上级 4b78474e
......@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.aria-container {
.monaco-aria-container {
position: absolute; /* try to hide from workbench but not from screen readers */
left:-999em;
}
\ No newline at end of file
......@@ -14,10 +14,10 @@ let ariaContainer: Builder;
let alertContainer: Builder;
let statusContainer: Builder;
export function setARIAContainer(parent: HTMLElement) {
ariaContainer = $('.aria-container').appendTo(parent);
ariaContainer = $('.monaco-aria-container').appendTo(parent);
alertContainer = $('.alert').appendTo(ariaContainer).attr({ 'role': 'alert', 'aria-atomic': 'true' });
statusContainer = $('.status').appendTo(ariaContainer).attr({ 'role': 'status', 'aria-atomic': 'true' });
alertContainer = $('.monaco-alert').appendTo(ariaContainer).attr({ 'role': 'alert', 'aria-atomic': 'true' });
statusContainer = $('.monaco-status').appendTo(ariaContainer).attr({ 'role': 'status', 'aria-atomic': 'true' });
}
/**
......
......@@ -25,6 +25,7 @@ import { InternalEditorAction } from 'vs/editor/common/editorAction';
import { MenuId, MenuRegistry, IMenuItem } from 'vs/platform/actions/common/actions';
import { IDiffEditorOptions, IEditorOptions } from 'vs/editor/common/config/editorOptions';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import * as aria from 'vs/base/browser/ui/aria/aria';
/**
* The options to create an editor.
......@@ -83,6 +84,15 @@ export interface IStandaloneDiffEditor extends IDiffEditor {
let LAST_GENERATED_COMMAND_ID = 0;
let ariaDomNodeCreated = false;
function createAriaDomNode() {
if (ariaDomNodeCreated) {
return;
}
ariaDomNodeCreated = true;
aria.setARIAContainer(document.body);
}
/**
* A code editor to be used both by the standalone editor and the standalone diff editor.
*/
......@@ -105,6 +115,9 @@ export class StandaloneCodeEditor extends CodeEditor implements IStandaloneCodeE
if (keybindingService instanceof StandaloneKeybindingService) {
this._standaloneKeybindingService = keybindingService;
}
// Create the ARIA dom node as soon as the first editor is instantiated
createAriaDomNode();
}
public addCommand(keybinding: number, handler: ICommandHandler, context: string): string {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册