Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lotas opened this issue Jun 10, 2024 · 5 comments

Comments

@lotas
Copy link

lotas commented Jun 10, 2024

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.

@lotas lotas added the bug label Jun 10, 2024
@working-name
Copy link
Collaborator

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:

  • each tab needs to be given a unique session id to track it among the other tabs the user may have open
  • all browsers should consistently restore localStorage as well when restoring a tab
  • there's a way to detect a tab was reopened for all browsers (I know there's some specific ways for Chrome-based and Firefox but not sure about Safari for example) to prompt the user or simply restore the content
  • the next logical step is for a user to request access to all edit history too, which means more code for CM integration to save and restore its history
  • the added burden of maintaining this feature's code has to be worth it

@lotas
Copy link
Author

lotas commented Jun 10, 2024

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
Copy link
Collaborator

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
Copy link
Author

lotas commented Jun 10, 2024

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

@firasdib
Copy link
Owner

I see where you're coming from. What happens is that as soon as something is changed in the editor, a flag is set, and this popup will be shown if the data is not saved.

I have considered saving things to storage automatically multiple times, but I haven't ironed out how to handle the UX of having multiple tabs at the same time. Which tabs data should I save? Should they overwrite each other? Etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants