Skip to content

Fix empty key exception in raw tag editor and clean up linting spacing#12043

Open
JaiswalShivang wants to merge 3 commits intoopenstreetmap:developfrom
JaiswalShivang:fix/raw-tag-editor-lint-spacing
Open

Fix empty key exception in raw tag editor and clean up linting spacing#12043
JaiswalShivang wants to merge 3 commits intoopenstreetmap:developfrom
JaiswalShivang:fix/raw-tag-editor-lint-spacing

Conversation

@JaiswalShivang
Copy link
Contributor

Fixes: [#11970 ]

Description

This PR addresses a bug in the raw tag editor where completely emptying a tag key could dispatch an unwanted or malformed change event. Additionally, it resolves some lingering ESLint formatting warnings in the file.

Changes made

  • Added empty key guard: Inserted an early if (!kNew) return; return in [raw_tag_editor.js] to prevent the editor from attempting to process and dispatch tag changes when a user clears a key input.
  • Added test coverage: Added an explicit test in [test/spec/ui/sections/raw_tag_editor.js] ensuring that emptying a key input correctly aborts and does not fire a change event.

Testing

  • All local tests pass (npm run test:once).
  • ESLint passes with zero warnings on the modified files.

@tyrasd
Copy link
Member

tyrasd commented Mar 18, 2026

Unfortunately, this does not seem to fix the glitch:

Screencast.From.2026-03-18.17-49-19.mp4

@JaiswalShivang
Copy link
Contributor Author

Hey @tyrasd! Thanks for the video—that helped me understand the exact glitch described in #11970 much better!
I realized my previous guard was only catching one specific scenario. The root cause of the UI cloning glitch was D3's data-binding freaking out when it encountered duplicate empty strings "" because the editor was previously allowing tags to be saved with empty keys.
I've just pushed a new commit that completely blocks the editor from setting or saving "" as a tag key in both
keyChange
(when attempting to delete a key) and

valueChange
(when typing a value without a key). It safely reverts or ignores the execution instead.
I've verified locally that the duplicate row UI bug is fully resolved now! Let me know if everything looks good to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants