Skip to content

React-hotkeys not working with lazy import #335

@MDalprato

Description

@MDalprato

Describe the bug
Hotkeys fires only once and the only way to fire them again it to set the focus on another element.

How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys etc)

Expected behavior
Hotkeys events should always works.

Platform (please complete the following information):

  • Version of react-hotkeys (latest)
  • Browser [e.g. chrome, safari] (chrome and safari)
  • OS: [e.g. iOS] (macOS and Windows)

If I import the component using the lazy option the hotkeys action fires only once.

const Test = lazy(() => import("./components/dashboard/Test"));

If I import the component using the 'standard' react options the hotkeys works fine:

import {Test} from "./components/dashboard/Test";

I'm not able to find a solution to this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions