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 broken on safari mobile #40

Closed
jdedwards3 opened this issue May 4, 2018 · 7 comments
Closed

back button broken on safari mobile #40

jdedwards3 opened this issue May 4, 2018 · 7 comments
Labels

Comments

@jdedwards3
Copy link

jdedwards3 commented May 4, 2018

to reproduce run the contact manager tutorial. using safari mobile on iPhone the back button does not trigger canDeactivate as expected.

candeactivate

this does not work on safari mobile, and on devices where the the promp is shown the browser history is not being maintained

click back
if not on safari mobile prompt shows
click cancel
click back
if not on safari mobile prompt shows
click ok
user is routed to two history locations back as back button was pressed twice(this might be a separate bug)

Expected: user is only routed one history location back. it seems like the browser history is not being maintained properly, besides the issue of the the back button triggering the prompt on safari mobile.

@3cp
Copy link
Member

3cp commented May 7, 2018

I can reproduce this bug with the code from https://github.com/aurelia/app-contacts, either with original package.json or with updated package.json (with latest aurelia dependencies).

There are two new issues here, not same as the linked issue router#574 which is solved.

  1. history stack is wrong when canDeactivate() is rejected (cancelled). Even with cancel on canDeactivate, it somehow affected the pointer to the last history entry, as @jimwards17 stated, it could wire back 2 steps instead of 1.
  • this issue can be reproduced with pushState on or off. It means the bug affects routes with both hash history and native history api.
  • router#574 is different, it only affects pushState=true. I can confirm it was fixed on app-contacts code, just don't modify any contact details, you can see back/forward buttons work as expected (with pushState on or off).
  1. somehow on iOS, confirm() doesn't work inside canDeactivate(), the confirm() call immediately returns false without showing any ui. More than that, when it happens, the whole ui is in a broken state.
  • could be an iOS Safari bug
  • I can manually trigger alert/confirm in dev console, they works normally. But once aurelia canDeactivate() is processed with a dead confirm(). I can no longer manually trigger alert/confirm in dev console, they skip the ui totally.

@3cp
Copy link
Member

3cp commented May 7, 2018

It is kind of a wrong place for this issue. Since it's not related with browser history api.

@jdedwards3
Copy link
Author

jdedwards3 commented May 7, 2018

@huochunpeng where would be a more appropriate place for this issue?

@3cp
Copy link
Member

3cp commented May 7, 2018

Not exactly sure, could be https://github.com/aurelia/history or https://github.com/aurelia/router.
I guess you don't need to worry about it. Who digs deeper on this issue will move it properly. I probably will try no.1 when I had more spare time in next few days/weeks.

@davismj davismj self-assigned this May 12, 2018
@davismj davismj added the bug label May 12, 2018
@davismj davismj removed their assignment May 12, 2018
@davismj
Copy link
Member

davismj commented May 12, 2018

(1) is a duplicate of aurelia/router#528

@huochunpeng any chance you can take a look at (2) and confirm whether it is an iOS issue or not?

@3cp
Copy link
Member

3cp commented May 12, 2018

I guess (2) is iOS bug. In aurelia/app-contacts#46, There is a related link showing a similar alert/confirm issue on iOS.

@davismj davismj closed this as completed May 12, 2018
@davismj
Copy link
Member

davismj commented May 12, 2018

Thanks @huochunpeng great work as always.

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

No branches or pull requests

3 participants