Skip to content

Commit

Permalink
Fix ace a11y listener (elastic#60639)
Browse files Browse the repository at this point in the history
Also move the hook use_ui_ace_keyboard_mode.tsx into es_ui_shared

This was defined (and used) in both Console and SearchProfiler.

Co-authored-by: Elastic Machine <[email protected]>
# Conflicts:
#	src/legacy/core_plugins/console/public/np_ready/application/containers/editor/legacy/use_ui_ace_keyboard_mode.tsx
#	src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx
#	src/plugins/console/public/application/containers/editor/legacy/use_ui_ace_keyboard_mode.tsx
#	src/plugins/es_ui_shared/public/index.ts
#	src/plugins/es_ui_shared/public/use_ui_ace_keyboard_mode.tsx
#	x-pack/legacy/plugins/searchprofiler/public/np_ready/application/editor/use_ui_ace_keyboard_mode.tsx
#	x-pack/plugins/searchprofiler/public/application/editor/editor.tsx
  • Loading branch information
jloleysens committed Mar 20, 2020
1 parent 54f8c49 commit ee1a10a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import * as qs from 'querystring-browser';

import { EuiIcon, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { useServicesContext, useEditorReadContext } from '../../../../contexts';
import { useUIAceKeyboardMode } from '../use_ui_ace_keyboard_mode';
import { useUIAceKeyboardMode } from '../../../../../../../../../../plugins/es_ui_shared/public';
import { ConsoleMenu } from '../../../../components';

import { autoIndent, getDocumentation } from '../console_menu_actions';
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/es_ui_shared/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@
*/

export * from './components/json_editor';

export { useUIAceKeyboardMode } from './use_ui_ace_keyboard_mode';
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function useUIAceKeyboardMode(aceTextAreaElement: HTMLTextAreaElement | n
}
return () => {
if (aceTextAreaElement) {
document.removeEventListener('keydown', documentKeyDownListener);
document.removeEventListener('keydown', documentKeyDownListener, { capture: true });
aceTextAreaElement.removeEventListener('keydown', aceKeydownListener);
const textAreaContainer = aceTextAreaElement.parentElement;
if (textAreaContainer && textAreaContainer.contains(overlayMountNode.current!)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React, { memo, useRef, useEffect, useState } from 'react';
import { Editor as AceEditor } from 'brace';

import { initializeEditor } from './init_editor';
import { useUIAceKeyboardMode } from './use_ui_ace_keyboard_mode';
import { useUIAceKeyboardMode } from '../../../../../../../../src/plugins/es_ui_shared/public';

interface EditorShim {
getValue(): string;
Expand Down

This file was deleted.

0 comments on commit ee1a10a

Please sign in to comment.