Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Services] Remove unused key services #7256

Merged
merged 7 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/components/context_menu/context_menu_panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { tabbable, FocusableElement } from 'tabbable';
import { CommonProps, NoArgCallback, keysOf } from '../common';
import { EuiIcon } from '../icon';
import { EuiResizeObserver } from '../observer/resize_observer';
import { cascadingMenuKeys } from '../../services';
import { keys } from '../../services';
import {
EuiContextMenuItem,
EuiContextMenuItemProps,
Expand Down Expand Up @@ -164,7 +164,7 @@ export class EuiContextMenuPanel extends Component<Props, State> {
document.activeElement === this.backButton ||
document.activeElement === this.panel)
) {
if (event.key === cascadingMenuKeys.ARROW_LEFT) {
if (event.key === keys.ARROW_LEFT) {
if (showPreviousPanel) {
event.preventDefault();
event.stopPropagation();
Expand All @@ -179,7 +179,7 @@ export class EuiContextMenuPanel extends Component<Props, State> {

if (items?.length) {
switch (event.key) {
case cascadingMenuKeys.TAB:
case keys.TAB:
requestAnimationFrame(() => {
// NOTE: document.activeElement is stale if not wrapped in requestAnimationFrame
const focusedItemIndex = this.state.menuItems.indexOf(
Expand All @@ -197,7 +197,7 @@ export class EuiContextMenuPanel extends Component<Props, State> {
});
break;

case cascadingMenuKeys.ARROW_UP:
case keys.ARROW_UP:
event.preventDefault();
this.focusMenuItem('up');

Expand All @@ -206,7 +206,7 @@ export class EuiContextMenuPanel extends Component<Props, State> {
}
break;

case cascadingMenuKeys.ARROW_DOWN:
case keys.ARROW_DOWN:
event.preventDefault();
this.focusMenuItem('down');

Expand All @@ -215,7 +215,7 @@ export class EuiContextMenuPanel extends Component<Props, State> {
}
break;

case cascadingMenuKeys.ARROW_RIGHT:
case keys.ARROW_RIGHT:
if (this.props.showNextPanel) {
event.preventDefault();
this.props.showNextPanel(
Expand Down
4 changes: 2 additions & 2 deletions src/components/popover/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { CommonProps, NoArgCallback } from '../common';
import { FocusTarget, EuiFocusTrap, EuiFocusTrapProps } from '../focus_trap';

import {
cascadingMenuKeys,
keys,
getTransitionTimings,
getWaitDuration,
performOnFrame,
Expand Down Expand Up @@ -383,7 +383,7 @@ export class EuiPopover extends Component<Props, State> {
};

onKeyDown = (event: KeyboardEvent) => {
if (event.key === cascadingMenuKeys.ESCAPE) {
if (event.key === keys.ESCAPE) {
this.onEscapeKey(event as unknown as Event);
}
};
Expand Down
15 changes: 0 additions & 15 deletions src/services/accessibility/accessible_click_keys.ts

This file was deleted.

36 changes: 0 additions & 36 deletions src/services/accessibility/cascading_menu_keys.ts

This file was deleted.

26 changes: 0 additions & 26 deletions src/services/accessibility/combo_box_keys.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/services/accessibility/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@
* Side Public License, v 1.
*/

export { accessibleClickKeys } from './accessible_click_keys';
export { cascadingMenuKeys } from './cascading_menu_keys';
export { comboBoxKeys } from './combo_box_keys';
export { htmlIdGenerator, useGeneratedHtmlId } from './html_id_generator';
8 changes: 1 addition & 7 deletions src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@

// Export all keys under a `keys` named variable
import * as keys from './keys';
export {
accessibleClickKeys,
cascadingMenuKeys,
comboBoxKeys,
htmlIdGenerator,
useGeneratedHtmlId,
} from './accessibility';
export { htmlIdGenerator, useGeneratedHtmlId } from './accessibility';
export { CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT } from './alignment';
export type { HorizontalAlignment } from './alignment';
export {
Expand Down
3 changes: 3 additions & 0 deletions upcoming_changelogs/7256.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Breaking changes**

- Removed exported `accessibleClickKeys`, `comboBoxKeys`, and `cascadingMenuKeys` services. Use the generic `keys` service instead
Loading