derikb / character-sheet-app

A responsive, online/offline web app to act as a character sheet for 5e D&D and other RPGs.
GNU General Public License v3.0
77 stars 32 forks source link

Add the ability to delete list entries with Backspace. #108

Closed kyledhardison closed 2 years ago

kyledhardison commented 2 years ago

I get a lot of use out of your tool in my D&D games, and really appreciate the work you've put into it.

While using it, I noticed that there wasn't any way to delete empty list entries that I mistakenly made, so I added the ability to delete blank list items by pressing backspace.

This applies to SimpleList, NoteList, and TableEditable types.

I also pulled the KeyPress logic from NoteListEntry up to NoteList for simplicity.

kyledhardison commented 2 years ago

Sorry about the delayed response - work and school have gotten busy.

I've addressed many of your comments, would you like me to resolve them myself?

I've also replied in a few places where clarification would be helpful - thanks!

derikb commented 2 years ago

Sorry for the long delay on this @kyledhardison Going to merge this to local issue-109 branch then will test out when everything is working right get into a release.

derikb commented 2 years ago

One thing I found that I am trying to solve now... is if you hit backspace you can get moved to the previous editable area, but the cursor goes to the start of that area, which seems unintuitive to me. Especially if you are trying to erase that content too. So... trying to figure out how to focus but move the cursor to the end of the content...

derikb commented 2 years ago

Another thing to watch out for. If you don't ev.preventDefault() on the backspace event, the cursor moves to the field and then can erase characters. This only really came to light when I switched the cursor to move to the end of the content. But always good to remember when messing with some of these events that you have to sometimes prevent the normal workings of the event.