Steps to replicate the issue (include links if applicable):
- Open a map in fullscreen mode and enable the external maps sidebar.
- Close the sidebar again and close the fullsceen view.
- Reopen that map or a different one on the same page.
What happens?:
The sidebar is extended.
What should have happened instead?:
It should not be extended if it was closed before.
Other information (browser name/version, screenshots, etc.):
The relevant line of code is an if ( dialog.sideBar ). This assumes the sidebar is visible when the object exists.
This check alone is not enough.
When the dialog opens for the first time no sidebar object is created. This happens later the first time the sidebar opens. This object is not destroyed when we keep toggling the sidebar but reused. aria-hidden="false" is what hides the sidebar from now on, here. The state is tracked via the value of the "External maps" toggle button, here.
Suggestion:
if ( dialog.sideBar ) { dialog.sideBar.tearDown(); dialog.map.doWhenReady( function () { var open = dialog.mapDetailsButton.getValue(); dialog.offsetMap( open ); dialog.toggleSideBar( open ); } ); } else {
I think this is broken ever since the code was added in https://gerrit.wikimedia.org/r/588121. Still qualifies as a Regression I believe.