Skip to content

Conversation

@benjiwheeler
Copy link
Contributor

Resolves

Proposed Changes

Currently, on modal mount, we adjust the window.history. If history.state === null, we push a new history entry; if it's not null, we just replace history.

The problem with this is that if we've already navigated within the single page application, say from the project page to editor, then history.state is not null; so we just replace history when the library modal is open. Then if the user hits the back button, the browser navigates back to the previous history entry -- in this case, the project page.

This change instead checks history.state === null || history.state !== this.id, which is more permissive; if the history.state entry exists but is not the same as the current view, we push, instead of replacing.

Reason for Changes

Browsing was behaving in an unexpected, frustrating way.

Test Coverage

I added a test of the back button functionality, but note that it doesn't actually fail if this code change isn't included. Still, I think it's good to have.

Browser Coverage

Check the OS/browser combinations tested (At least 2)

Mac

  • Chrome
  • Firefox
  • Safari

Windows

  • Chrome
  • Firefox
  • Edge

Chromebook

  • Chrome

iPad

  • Safari

Android Tablet

  • Chrome

elementIsVisible (element) {
return this.driver.wait(until.elementIsVisible(element));
}
elementIsNotVisible (element) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably remove this since it's not being used anywhere

Copy link
Contributor

@kchadha kchadha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! In the future I think we should probably add something like this to tab switching as well (e.g. costumes/sounds)

@kchadha kchadha assigned benjiwheeler and unassigned kchadha Dec 20, 2018
@benjiwheeler benjiwheeler merged commit d76b74e into scratchfoundation:develop Dec 20, 2018
@benjiwheeler benjiwheeler deleted the library-history2 branch December 20, 2018 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants