getkirby / kirby

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

[Panel] ESC-Key closes StructureFields Row and save changes, but should act as cancel #4758

Closed dennisbaum closed 1 year ago

dennisbaum commented 1 year ago

Description

If i open a row of a structure field and change something in the detail-view, pressing ESC-Key closes the details BUT saves the changes to the structure-field. the status of the page is then dirty.

Expected behavior
I'd expect ESC to be the same as clicking on Cancel. The changes should not be saved. The status of the page should stay as before

To reproduce

  1. Go to a page in the panel with a structure field
  2. Click on a row to open the details or add a new item
  3. change any field
  4. press the ESC-Key

Your setup

K3.7.5

Console output
no javascript error

Your system (please complete the following information)

afbora commented 1 year ago

Seems this behavior is intended. What does the team think? Should it be closed or improved?

https://github.com/getkirby/kirby/blob/368264f64991cf19dbb567306137970da2cebcb1/panel/src/components/Forms/Field/StructureField.vue#L384-L398

lukasbestle commented 1 year ago

I agree that ESC should be treated as "Cancel" with the current implementation.

But with our planned refactoring of the structure field, every change inside a structure row will immediately be synced with the global content object of the whole page (meaning that saving changes in a structure entry is no longer needed). Discarding will then happen with the Unsaved Changes bar like with any other field. At this point the "Cancel" button will no longer be needed.

dennisbaum commented 1 year ago

If i get you right, there is no need to save the structure field AND save the page after that planned refactoring? i would looove that! lots of editors (myself included) always forget to save twice.

lukasbestle commented 1 year ago

Yep. You will be able to just leave the structure field and save the page.

dennisbaum commented 1 year ago

so i will close that issue and looking forward to the new structure-field. thx!