Its not really WikiTree's fault that your data was lost. The unsaved data only exist in your local browser window until you upload it back to WikiTree by saving. This form data is not saved anywhere until the user (or special hidden code either embedded within the page or your browser) initiates a "save".
So when your browser switches pages, the unsaved data in the previous page is then discarded. Its how most browsers work. (as Linda mentions, there are some browsers that are able to "save" the unsaved data by caching it locally)
Websites that require password authentication have to periodically refresh/request that auth information, which then forces a page switch when your current login session expires. And by default, the session is not very long.
When you login, make sure you tick the checkbox to "remember my login", because this will increase the default session time. The "remember me" option uses cookies to store that info on your local computer, so that each new page switch won't have to re-ask you to enter it. It just reads it from your cookie data on disk.