Skip to content

Space no longer working in the rest of the application #350

@eliandoran

Description

@eliandoran

Describe the bug

I've had people report that in our web application (Trilium Notes), the space key would not work at all (to enter a note title, to type text, etc.).

After investigation, it turns out the problem comes from Mind Elixir, more specifically there appears to be an event handler that consumes the space bar globally.

  const handleKeyDown = (e: KeyboardEvent) => {
    if (e.code === 'Space') {
      mind.spacePressed = true
      mind.container.classList.add('space-pressed')
      e.preventDefault() // 防止页面滚动
    }
  }

{ dom: document, evt: 'keydown', func: handleKeyDown },

The regression came from fb9ef30, which was released starting with 5.2.1.

To Reproduce
Steps to reproduce the behavior:

  1. Render a mind map alongside a text box.
  2. Focus the textbox and type words with spaces.
  3. Notice how the space doesn't work anymore.

Expected behavior

The space bar should work fine.

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