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

Back button allows page change when a modal window is shown. #4555

Closed
vaadin-bot opened this issue Oct 10, 2013 · 8 comments
Closed

Back button allows page change when a modal window is shown. #4555

vaadin-bot opened this issue Oct 10, 2013 · 8 comments
Labels
bug Stale Stale bot label

Comments

@vaadin-bot
Copy link
Collaborator

Originally by @MTzukanov


When a modal window is open, pressing back in browser can change the url and the application state beyond the modal window.


Imported from https://dev.vaadin.com/ issue #12739

@vaadin-bot
Copy link
Collaborator Author

Originally by @Artur-


A lot of tickets have been left hanging in the issue tracker through the years. Some of them are still relevant, some of them have been fixed a long time ago and some are no longer valid. To get a better look on what is important and still relevant, we are closing old tickets which have not been touched in a long time.

No further work will be done on this ticket unless someone indicates that it's still relevant.

If this ticket is still relevant to you, please reopen it.

@vaadin-bot
Copy link
Collaborator Author

Originally by timohartmann


I still have the same problem. Using vaadin version 7.3.3

@vaadin-bot
Copy link
Collaborator Author

Originally by bstumm


Vaadin Version 7.4.1. Problem still exists. When an modal window is open, it will stay open, and the application state in the background changes.

@vaadin-bot
Copy link
Collaborator Author

Originally by @MTzukanov


I succeeded in preventing this by using a custom UriFragmentManager.

Here's the code:

public class TestnavigatorUI extends UI {
	@WebServlet(value # "/*", asyncSupportedtrue)
	@VaadinServletConfiguration(productionMode # false, uiTestnavigatorUI.class)
	public static class Servlet extends VaadinServlet {
	}

	@Override
	protected void init(VaadinRequest request) {
		Navigator navigator = new Navigator(this, new CustomUriFragmentManager(getPage()),
									new Navigator.SingleComponentContainerViewDisplay(this));
		
		navigator.addView("", new MyView("view 1"));
		navigator.addView("test2", new MyView("view 2"));
		navigator.addView("test3", new MyView("view 3"));
	}

	class MyView extends VerticalLayout implements View {
		public MyView(String caption) {
			addComponent(new Button(caption, e -> {
				Window window = new Window();
				window.setModal(true);				
				UI.getCurrent().addWindow(window);
			}));
		}
		
		@Override
		public void enter(ViewChangeEvent event) {}
	}
	
	private boolean isModalWindowShown() {
                return getWindows().stream().anyMatch(Window::isModal);
	}
	
	class CustomUriFragmentManager extends UriFragmentManager {
		private String uriFragment = Page.getCurrent().getUriFragment();
		
		public CustomUriFragmentManager(Page page) {
			super(page);
		}
		
		@Override
		public void uriFragmentChanged(UriFragmentChangedEvent event) {
			if (!isModalWindowShown()) {
				uriFragment = event.getUriFragment();
				super.uriFragmentChanged(event);
			} else {
				Page.getCurrent().setUriFragment(uriFragment, false);
			}
		}
	}
}

@vaadin-bot vaadin-bot added the bug label Dec 10, 2016
@stale
Copy link

stale bot commented Mar 20, 2018

Hello there!

It looks like this issue hasn't progressed lately. There are so many issues that we just can't deal them all within a reasonable timeframe.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

  • Check if the issue is still valid for the latest version. There are dozens of duplicates in our issue tracker, so it is possible that the issue is already tackled. If it appears to be fixed, close the issue, otherwise report to the issue that it is still valid.
  • Provide more details how to reproduce the issue.
  • Explain why it is important to get this issue fixed and politely draw others attention to it e.g. via the forum or social media.
  • Add a reduced test case about the issue, so it is easier for somebody to start working on a solution.
  • Try fixing the issue yourself and create a pull request that contains the test case and/or a fix for it. Handling the pull requests is the top priority for the core team.
  • If the issue is clearly a bug, use the Warranty in your Vaadin subscription to raise its priority.

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

@stale stale bot added the Stale Stale bot label label Mar 20, 2018
@akohlbecker
Copy link

This issue is still valid for vaadin 7.7.13

@stale stale bot removed the Stale Stale bot label label Jul 24, 2018
@stale
Copy link

stale bot commented Dec 21, 2018

Hello there!

We are sorry that this issue hasn't progressed lately. We are prioritizing issues by severity and the number of customers we expect are experiencing this and haven't gotten around to fix this issue yet.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

  • Check if the issue is still valid for the latest version. There are dozens of duplicates in our issue tracker, so it is possible that the issue is already tackled. If it appears to be fixed, close the issue, otherwise report to the issue that it is still valid.
  • Provide more details how to reproduce the issue.
  • Explain why it is important to get this issue fixed and politely draw others attention to it e.g. via the forum or social media.
  • Add a reduced test case about the issue, so it is easier for somebody to start working on a solution.
  • Try fixing the issue yourself and create a pull request that contains the test case and/or a fix for it. Handling the pull requests is the top priority for the core team.
  • If the issue is clearly a bug, use the Warranty in your Vaadin subscription to raise its priority.

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

@stale stale bot added the Stale Stale bot label label Dec 21, 2018
@stale
Copy link

stale bot commented Jun 26, 2021

The issue was automatically closed due to inactivity. If you found some new details to it or started working on it, comment on the issue so that maintainers can re-open it.

@stale stale bot closed this as completed Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Stale Stale bot label
Projects
None yet
Development

No branches or pull requests

2 participants