Hmm I actually don’t think hitting F12 is your fault, and completely agree it’s not the best design (I don’t know if I’d go as far as to say poor design, since F5 could cause far more havoc than F12 and is far easier to accidentally hit than F12).
What I thought was your fault was the fact that to delete an element from the Elements tab you need to be clicked on it and hit either “Delete” or “Backspace”. But I guess if you’re typing something fast and didn’t notice the Elements menu open you could hit backspace to delete text which would actually delete an element since as you said, it auto selects the
body tag (which is kinda silly overall but unrelated).
I support removing F12 as we already have Ctrl + Shift + I to do the same functionality, hopefully someone on the team checks this post out. Although if you run into this issue in the future, you can usually Ctrl + Z to undo the deletion and get all your lost work back (as long as you didn’t close the Elements menu).
I tested it while writing this post and the text box wasn’t empty after my Ctrl + Z. It probably depends heavily on how the site you’re on handles it’s forms though, as I imagine a JS based form will fare better than something that works with pure HTML since that’s what’s being deleted and undeleted.