Skip to content

fix(properties): stop the property row eating the space bar - #1895

Merged
h4yfans merged 2 commits into
mainfrom
property-name-space-input
Aug 30, 2026
Merged

fix(properties): stop the property row eating the space bar#1895
h4yfans merged 2 commits into
mainfrom
property-name-space-input

Conversation

@h4yfans

@h4yfans h4yfans commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Typing movie series into a property field produced movieseries. Reported by a customer on
v2026-08-25 as "Properties do not allow spaces anymore".

Root cause: apps/desktop/src/renderer/src/components/note/info-section/PropertyRow.tsx:514.
A property row's value slot is a role="button" div that starts editing on Enter or Space, and it
called preventDefault() for those keys on every keydown it saw:

onKeyDown={(e) => {
  if (e.key === 'Enter' || e.key === ' ') {
    e.preventDefault()
    handleStartEdit()
  }
}}

React routes synthetic events up the component tree, so every editor rendered under
PropertyValueRenderer fed its keydowns through that handler. The space was cancelled before the
browser could insert it. This reaches further than it looks: the select, status and multiselect
pickers render into a Radix portal, whose DOM node sits on document.body but whose React parent is
still this div, so their option-name and search inputs were hit too.

Affected inputs, all under that one wrapper: text, number, URL and long-text property values,
plus the option-name and search fields of select, status, multiselect, relation and project
properties.

The fix is one line — activate only on the wrapper's own keystrokes. A keydown that started in a
descendant belongs to that descendant.

Not affected

Two nearby fields were checked and are fine, and the E2E covers both so they stay that way:

  • The add-property name field (AddPropertyPopup.tsx) is not under this wrapper. This is the
    field the bug was first attributed to; it always accepted spaces.
  • Renaming a property (PropertyRow.tsx:465) is a sibling of the value slot, not a child.

Same shape elsewhere, left alone

folder-table-view.tsx:998 and grouped-table.tsx:980 do the same unguarded case ' ': preventDefault()
on a role="grid" container. They are safe today only because every editable cell shields itself with
onKeyDown={stopPropagation} (folder-view/property-cell.tsx:406,440). Not touched here — no evidence
of a live bug, and widening the diff into a second surface is not what this fix needs.

Release note

Fixed: you can type spaces in note property values again, and in select, status and multiselect
option names.

Test plan

New E2E apps/desktop/tests/e2e/property-space-input.e2e.ts, driving real key events
(keyboard.type, never fill()fill() sets the value directly and passes even while every
keystroke is being swallowed). Committed before the fix so the history shows it failing.

Before the fix:

✓ 1 the add-property name field keeps the space in "movie series" (19.1s)
✘ 2 a text property value keeps the space in "movie series" (30.4s)
✘ 3 a new select option name keeps the space in "movie series" (29.5s)
✓ 4 renaming a property keeps the space in "movie series" (17.7s)
  Expected: "movie series"
  Received: "movieseries"
2 failed, 2 passed

After:

✓ 1 the add-property name field keeps the space in "movie series" (17.4s)
✓ 2 a text property value keeps the space in "movie series" (17.5s)
✓ 3 a new select option name keeps the space in "movie series" (16.6s)
✓ 4 renaming a property keeps the space in "movie series" (17.3s)
4 passed (6.0m)

New renderer test PropertyRow.space-input.test.tsx renders the real editors — the existing
PropertyRow.test.tsx stubs them all out, which is why it never saw this. Covers the direct child
input, the portalled select option name, and that a genuine Space on the wrapper still opens the
editor. 2 failed / 1 passed before, 3 passed after.

Gates, all green:

  • pnpm lint — 0 errors, 109 pre-existing warnings
  • pnpm typecheck — exit 0
  • pnpm --filter @memry/desktop test:renderer — 700 files, 8527 passed
  • pnpm test:e2e -- property-space-input.e2e.ts — 4 passed
  • pnpm check:architecture — passed
  • git diff --check — clean

docs:impact flagged missing-docs and was waived with MEMRY_DOCS_IMPACT_SKIP=1. This restores
behaviour the docs already assume — apps/docs/src/user-guide/notes/properties-tags.md describes
setting property values inline and never suggested spaces were special. Documenting "spaces work" would
only describe the bug.

@github-actions github-actions Bot added bug Something isn't working test labels Aug 30, 2026
@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 7e4df49.

@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@h4yfans
h4yfans force-pushed the property-name-space-input branch from 7cc3029 to dfc670b Compare August 30, 2026 16:09
Typing `movie series` into a property field lands `movieseries`. Four
cases: the add-property name field, a text property's value, a new select
option's name, and renaming a property. Two of them fail today.

Real key events throughout — `fill()` and stubbed editors both pass while
every keystroke is being swallowed, which is why the existing
PropertyRow.test.tsx never saw this.
A property row's value slot is a `role="button"` div that starts editing on
Enter or Space, and it called `preventDefault()` for those keys on every
keydown it saw. React routes synthetic events up the component tree, so the
text/number/url/long-text inputs under it — and, through the Radix portal,
the select, status and multiselect option-name and search inputs — all fed
their keydowns through that handler. Every space typed into a property was
cancelled before the browser could insert it, which is the reported
`movie series` becoming `movieseries`.

Activate only on the wrapper's own keystrokes. A keydown that started in a
descendant belongs to that descendant.

The same shape sits unguarded on the folder-view grid
(folder-table-view.tsx, grouped-table.tsx); those are still safe because
every editable cell shields itself with `onKeyDown={stopPropagation}`.
@h4yfans
h4yfans force-pushed the property-name-space-input branch from dfc670b to 7e4df49 Compare August 30, 2026 18:13
@h4yfans
h4yfans marked this pull request as ready for review August 30, 2026 18:37
@h4yfans
h4yfans merged commit d014183 into main Aug 30, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant