firasdib / Regex101

This repository is currently only used for issue tracking for www.regex101.com
3.2k stars 198 forks source link

"This page is asking you to confirm that you want to leave — information you’ve entered may not be saved." #2294

Open lotas opened 2 weeks ago

lotas commented 2 weeks ago

Bug Description

Currently if you have nothing entered in Regular expression and Test string fields, and try to close the page, it still shows the warning

image

Reproduction steps

  1. go to https://regex101.com/
  2. enter any character in any field
  3. remove it
  4. try to close the page

Expected Outcome

Warning is not shown.

Browser

Firefox 128

OS

MacOS

On a side note, the requirement to click through an extra popup confirmation when closing the tab or navigating away is quite disturbing, imho. Wouldn't it be more user-friendly to use session storage or local storage to automatically save the currently entered text? This way, if a user accidentally closes the tab, they can reopen it and return to their last entered state without the disruption of a confirmation popup.

Thank you for considering this improvement.

working-name commented 2 weeks ago

Hello! This is a good point that it should not bug when you've cleared all input from both fields, but there's also the matter of undo. What if the question triggers your memory and you realize you had some text a couple iterations back and you want it back?

As far as the suggestion to save the input to localStorage, that may be feasible, but there are some considerations:

lotas commented 2 weeks ago

Thanks @working-name I only mentioned using storage as an alternative to a not worrying about not loosing the progress. I'm pretty sure there might be different ways of achieving this. Like keeping a "recent regexps" history could be sufficient.

As an example, I've just closed this tab as I was typing in a comment, and github didn't block it with a modal window asking me to confirm it. Instead, on re-open, my message was still here.

Plus I think that this should be still labeled as bug, because the inputs are empty when I'm closing the window. Thanks

working-name commented 2 weeks ago

Gotcha, thank you.

The reason I didn't leave it as a bug is because this doesn't happen unless you make edits. That qualifies as "information you've entered may not be saved". If you do not actually enter any information in the first place the prompt does not appear. At least not in any browsers I've tested, including Firefox. Do you find that prompt appears when you input nothing at all as well? That would be a bug, indeed.

lotas commented 2 weeks ago

I do make edits :) but then remove them, either by hitting backspace or doing Undo action. In any case the input is blank. My point is that if the inputs are blank there is no need for extra confirmation dialog window. /shrug