getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.32k stars 168 forks source link

Tags field loses content when saving #4590

Closed medienbaecker closed 2 years ago

medienbaecker commented 2 years ago

Description

When saving the page directly after typing some text, the tags field will disregard the input. You have to blur the field or press enter to actually trigger a change.

Expected behavior
The field should not lose content.

Screenshots

tags

To reproduce

  1. Add a tags field to your blueprint
  2. Enter some text
  3. Hit ⌘S or Ctrl + S depending on your OS

Your setup

Kirby Version
3.7.4-rc.1

distantnative commented 2 years ago

TagsInput.vue will need something like this:

// make sure to commit input value when Cmd+S is hit
this.$events.$on("keydown.cmd.s", this.onBlur);

Should be relatively easy to fix.

lukasbestle commented 2 years ago

@distantnative I suggest we move this to 3.8.0 because there will not be another RC before the release of 3.7.4.

distantnative commented 2 years ago

sure

distantnative commented 2 years ago

It's also not as easy as I thought. We actually already listen to the keyboard shortcut - but what seems to happen is a race condition, where the watcher receives the old input again and updates the local data before the newly committed value has been emitted.

trych commented 2 years ago

Maybe I add this to the same issue, as this is closely related. When enter some comma separated tags and then instead of hitting enter, I click outside the field, the tags will visually show as one big, merged tag:

Bildschirmfoto 2022-09-12 um 16 22 27

They are correctly saved to the content file though and when I leave the page and then navigate back to it, they show correctly again:

Bildschirmfoto 2022-09-12 um 16 23 20

When I hit enter in the tag field, the tags are separated correctly directly.

distantnative commented 2 years ago

@trych moved this to its own issue as it's not caused by the same code (yours is much easier to fix)

bastianallgeier commented 2 years ago