mathesar icon indicating copy to clipboard operation
mathesar copied to clipboard

Esc key should cancel edits instead of saving

Open seancolsen opened this issue 2 years ago • 17 comments

Steps to reproduce

  1. Begin editing a text cell.
  2. Modify the contents.
  3. Press the Esc key.
  4. Expect the cell to transition to select mode, restoring the value before you began making your edits.
  5. Observe the cell to transition to select mode, saving the value you entered.

Expected behavior

  1. For stepped input columns (all string based columns, number etc.,) which contain an edit mode, "Esc" key in edit mode should revert the value to what is present in the DB and cancel unsaved edits.
  2. For all other columns, "Esc" key would essentially do nothing since value change is based on different interactions.

Additional context

  • The current behavior was established in #1080.
  • "Save of Esc" is consistent with AirTable.
  • "Cancel on Esc" is consistent with LibreOffice and Google Sheets

seancolsen avatar Mar 02 '22 13:03 seancolsen

@ghislaineguerin Can you give an opinion before we proceed? If you want to maintain consistency with spreadsheets, then we can change the status of this issue to "ready" and move forward with implementation. If you want to maintain consistency with AirTable, then we can close this issue.

Personally, I lean towards maintaining consistency with spreadsheets, but I'll defer to @ghislaineguerin.

seancolsen avatar Mar 02 '22 13:03 seancolsen

Personally, I lean towards maintaining consistency with spreadsheets

We cannot do that for columns like Boolean, Select, Multi-select etc., because they have widely different interaction mechanisms.

We need to take into account all the different column types before we finalize this UX.

pavish avatar Mar 02 '22 13:03 pavish

I'll try to frame the rule that I'm proposing in a way that would allow us to consistently follow the same rule across our product:

  • If you've transitioned from "select mode" to "edit mode", then Esc should transition you back to "select mode" without saving the edits you made while in "edit mode"

Columns like Boolean, Select, Multi-select won't have an "edit mode", right? So the above rule would not apply to them.

seancolsen avatar Mar 02 '22 14:03 seancolsen

Columns like Boolean, Select, Multi-select won't have an "edit mode", right? So the above rule would not apply to them.

My argument is that this would produce an even more confusing user experience. It will lead to the user not understanding what esc actually does. Whatever mechanism we fix on, I'd want it to be consistent across our product instead of trying to be partially consistent with spreadsheets.

pavish avatar Mar 02 '22 14:03 pavish

From a data integrity point of view (regardless of consistency with other tools), I think it's better to have Esc revert to the saved value in the DB rather than try to save something partial. I think it would be consistent to do this in any field that accepts text input.

I don't think it would produce a confusing user experience – users would understand that "Esc" = revert to the saved value. For anything where an interaction actually saves the value (like boolean, select, etc.), there would be no different saved value to revert to.

kgodey avatar Mar 02 '22 14:03 kgodey

I agree with @kgodey on restoring the saved DB value and making this a standard behavior for text inputs. Boolean and select don't have an edit mode since they can interact directly (assuming I couldn't test this in staging). I think this applies to leaving edit mode without saving changes, in which case, edit mode should behave consistently.

ghislaineguerin avatar Mar 03 '22 07:03 ghislaineguerin

All three of you seem to be in agreement, so I think we can proceed with the behaviour from @seancolsen's and @kgodey's comments.

I'm editing the issue description and marking it as ready.

pavish avatar Mar 03 '22 13:03 pavish

I would like to work on this issue.

akshat2602 avatar Mar 22 '22 11:03 akshat2602

@akshat2602 Go ahead! I've assigned this issue to you.

pavish avatar Mar 22 '22 11:03 pavish

@akshat2602 I wanted to follow up on this issue since it's been a few days and I don't see a PR yet. Please let us know if you need any help or if you are no longer working on the issue.

kgodey avatar Mar 29 '22 01:03 kgodey

@akshat2602 I wanted to follow up on this issue since it's been a few days and I don't see a PR yet. Please let us know if you need any help or if you are no longer working on the issue.

Hey, I have been trying to work on the issue but I can't figure my way into Svelte and am also having issues taking out time to work on the PR. You can remove me as an assignee for now. I will try to work but I can't commit to fully fixing the bug.

akshat2602 avatar Mar 29 '22 13:03 akshat2602

Thanks @akshat2602 no worries. I've unassigned you.

seancolsen avatar Mar 29 '22 14:03 seancolsen

If this issue is up for taking, I would like to work on this :)

shrey27tri01 avatar Mar 31 '22 15:03 shrey27tri01

go ahead @shrey27tri01!

kgodey avatar Apr 01 '22 00:04 kgodey

@shrey27tri01 are you still working on this?

kgodey avatar May 06 '22 16:05 kgodey

I have created a pull request with the necessary required changes , please inform if i am supposed to alter the request . Thanks

chidam333 avatar Oct 06 '22 01:10 chidam333

Thanks @chidam333! Someone from the team will review the PR within a few days.

kgodey avatar Oct 06 '22 01:10 kgodey