[openstreetmap/openstreetmap-website] Add unsaved changes warning to message and diary forms (PR #7076)

Nam Pham notifications at github.com
Mon May 11 13:17:49 UTC 2026


phanq003 left a comment (openstreetmap/openstreetmap-website#7076)

With tests, originally tried to test the `beforeunload` popup directly using `dismiss_confirm`  (see commit [05fc44b](https://github.com/openstreetmap/openstreetmap-website/pull/7076/commits/05fc44b8a5c867d2e088a94acf579296750916ed)), but according to [https://makandracards.com/makandra/622849-allow-testing-beforeunload-confirmation-dialogs-modern](https://makandracards.com/makandra/622849-allow-testing-beforeunload-confirmation-dialogs-modern) ChromeDriver 127+ automatically closes the dialogs. This is causing `Capybara::ModalNotFound: Unable to find modal dialog`.

Attempted to work around this adapting the solution from the mentioned reference, but then would get `Selenium::WebDriver::Error::SessionNotCreatedError: session not created: Chrome instance exited`.

As a workaround I've used a DOM attribute to keep track of when the listener is attached to be able to test that its there.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7076#issuecomment-4421048988
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/7076/c4421048988 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260511/131716ae/attachment.htm>


More information about the rails-dev mailing list