Skip to content

Commit

Permalink
#5139 - After pressing the Clear Canvas button in sequence-editing vi…
Browse files Browse the repository at this point in the history
…ew, the Enter button does not start a new sequence but erases it (#6145)

#4338 - After Undo/Redo actions Enter repeats these actions.
  • Loading branch information
rrodionov91 authored Dec 13, 2024
1 parent ebb65a9 commit 892fe60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { type IconName } from 'ketcher-react';
import { useMenuContext } from '../../../hooks/useMenuContext';
import { useCallback } from 'react';
import { StyledIconButton } from './styles';
import { blurActiveElement } from 'helpers/canvas';

type MenuItemProp = {
itemId: IconName;
Expand All @@ -37,6 +38,8 @@ const MenuItem = ({

const onClickCallback = useCallback(() => {
activate(itemId);
blurActiveElement();

if (onClick) {
onClick();
}
Expand Down
5 changes: 5 additions & 0 deletions packages/ketcher-macromolecules/src/helpers/canvas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export function blurActiveElement() {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
document.activeElement?.blur();
}

0 comments on commit 892fe60

Please sign in to comment.