Leading spaces in new tag input cause problems on validations

Steps to reproduce

In a Tags type property, with several tags already, type down some spaces, and press Enter to submit.

Better to test in a vault that have some tags created, for testing the behavior of auto-complete.

Did you follow the troubleshooting guide? [Y]

Reproducible in the sandbox vault.

Expected result

After submission, validating is expected to work and give error indications.

Actual result

No error hint, and the input persists.

Further typing non-space characters can call up auto complete if the text part matches, and if Enter is pressed the related tag would be added as is, correctly. If we manually compelet the tag after seeing the auto-complete, and type some more spaces, the input will accept the trailing spaces and the auto-complete still matches the trimmed proposing tag.

The input call by editing existing tags won’t trigger auto-complete, so there’s no following problems. The input value is validated as is, with leading/trailing spaces recognized as invalid chars.


Obsidian version: v1.4.16
Installer version: v1.4.13
Operating system: Windows 10 Home China 10.0.19045
Login status: logged in
Catalyst license: insider
Insider build toggle: on
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 1
Plugins enabled: 0


Additional information

I can’t reproduce. Post a screen recording of this happening in the sandbox vault.

Screen recording here. Tags test-1, test-2, test-3 and tags were pre-created in other files to feed the auto complete.


I don’t see what’s the problem in your screen recording. Leading and trailing spaces are removed. That seems fine for me.

Yeah adding tags works fine, but from a UI perspective, should the auto-complete be activated when some spaces were typed in advance? Also should the auto-complete match the trimmed value, not the actual one? It’s worth noting that for other list fields, the auto-complete feature isn’t triggered if there are leading spaces.

In addtion, I just noticed that navigating left over the beginning for a proposed tag with leading spaces, the validation will fail even if the trimmed value is inclued in the auto-complete.

I understand that these components are complex, and that’s why we need to handle them with extra care.

Given that tags must be single words, I don’t see a problem with the current behavior.

OK then. Thanks quite a lot for taking time reviewing this. Mark this as resolved or as-design anyway.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.