ericberman / MyFlightbookWeb

The website and service for MyFlightbook
48 stars 18 forks source link

Pop-up action list bug when using browser BACK button #362

Closed KayRJay closed 5 years ago

KayRJay commented 5 years ago

If a user presses the browser BACK button from the Edit page, the pop-up action list (Edit this flight, etc) remains on screen. This is ok, but it should be cleared if any other clickable item is selected

ericberman commented 5 years ago

Huh? Attach a screenshot pls, I'm not following. I just tried hovering over the pop-up but if I move the mouse to click the browser's back button, the pop-up goes away, and if I use the keyboard to navigate back, it also goes away.

KayRJay commented 5 years ago

Your missing step is to do it from the Edit page ...

Screen Shot 2019-08-26 at 12 20 49 PM
ericberman commented 5 years ago

Weird I can't reproduce that at all. You say "From the edit page", but the edit page doesn't have that pop-up - the list page does. Can you give the URL of the before/after page?

What's weird as well is that the pop-up is just a div within the page. I.e., any page navigation replaces the whole page (of which the pop-up is a part), so it should go away. What browser are you using and on which os? Could be a browser bug...

KayRJay commented 5 years ago

While you're ON the Edit page, use the browser's button to go back. I'm using Safari on Mac. I guess it is a Safari bug (or perhaps a specific design choice?). It does not happen on Chrome or Firefox.

From https://myflightbook.com/logbook/Member/LogbookNew.aspx use the action list to "Edit this flight".

Takes me to https://myflightbook.com/logbook/Member/LogbookNew.aspx/8277715.

Hit the browser back button, which goes to https://myflightbook.com/logbook/Member/LogbookNew.aspx

ericberman commented 5 years ago

Bingo! Looks like any pop-up displays that behavior. That's either a safari bug or a bug in my ajax library. I can look at updating the ajax library and see if that solves it, but I may not be able to do anything about this.

KayRJay commented 5 years ago

Yeah, it’s a bug somewhere!

But, at the cost of adding a “refresh” button when any clickable field is checked, you can make the issue disappear visually, though not solving it really.

On Aug 26, 2019, at 12:40 PM, Eric Berman notifications@github.com wrote:

Bingo! Looks like any pop-up displays that behavior. That's either a safari bug or a bug in my ajax library. I can look at updating the ajax library and see if that solves it, but I may not be able to do anything about this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericberman/MyFlightbookWeb/issues/362?email_source=notifications&email_token=AEBRDEGRMC4ARV7ZGR4YLGDQGQPQ7A5CNFSM4IPPXPDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5FISWI#issuecomment-524978521, or mute the thread https://github.com/notifications/unsubscribe-auth/AEBRDECUGEGESO6YSTSGFLTQGQPQ7ANCNFSM4IPPXPDA.

ericberman commented 5 years ago

Not quite sure what you mean by adding a refresh button. But replacing all links in popups with javascript that dismisses the pop-up before navigating is not a practical solution either...

KayRJay commented 5 years ago

I didn’t mean that. I meant this … when the user presses any clickable field on the Edit page, you automatically refresh the page (if the user is using Safari). This would of course not apply to the links in the popup, just others on the Edit page. Or, maybe you can detect the use of the BACK button and do a refresh of the previous page rather than use the browser to display the page?

On Aug 26, 2019, at 12:44 PM, Eric Berman notifications@github.com wrote:

Not quite sure what you mean by adding a refresh button. But replacing all links in popups with javascript that dismisses the pop-up before navigating is not a practical solution either...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericberman/MyFlightbookWeb/issues/362?email_source=notifications&email_token=AEBRDECR5TDJMVC2CHVUBTDQGQP7HA5CNFSM4IPPXPDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5FI6HA#issuecomment-524979996, or mute the thread https://github.com/notifications/unsubscribe-auth/AEBRDEFTQJUKQQ7HZTNWKUTQGQP7HANCNFSM4IPPXPDA.

ericberman commented 5 years ago

Can't detect use of the back button (as far as I'm aware), and even so wouldn't want to do a refresh (page resubmit). I use the popups all over the place; this isn't unique to the edit page.

ericberman commented 5 years ago

Just tried updating the ajax toolkit on my dev machine, still happens.

KayRJay commented 5 years ago

It would of course be best to truly fix the problem addressing the root cause.

Most (all?) of the other popups appear via hover, not with a click like the action list. Such pop-ups disappear when you move the cursor -.> not a problem. As far as I can tell, this is only an issue for the action list.

On Aug 26, 2019, at 12:51 PM, Eric Berman notifications@github.com wrote:

Can't detect use of the back button (as far as I'm aware), and even so wouldn't want to do a refresh (page resubmit). I use the popups all over the place; this isn't unique to the edit page.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericberman/MyFlightbookWeb/issues/362?email_source=notifications&email_token=AEBRDEBY7J3P2JIGJ4RTWK3QGQQ33A5CNFSM4IPPXPDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5FJWEQ#issuecomment-524983058, or mute the thread https://github.com/notifications/unsubscribe-auth/AEBRDEAVV4GT2KZ2BNMELI3QGQQ33ANCNFSM4IPPXPDA.

KayRJay commented 5 years ago

This may be helpful:

https://stackoverflow.com/questions/8788802/prevent-safari-loading-from-cache-when-back-button-is-clicked https://stackoverflow.com/questions/8788802/prevent-safari-loading-from-cache-when-back-button-is-clicked

On Aug 26, 2019, at 12:55 PM, Ken Jacobs jacobs_k@me.com wrote:

It would of course be best to truly fix the problem addressing the root cause.

Most (all?) of the other popups appear via hover, not with a click like the action list. Such pop-ups disappear when you move the cursor -.> not a problem. As far as I can tell, this is only an issue for the action list.

On Aug 26, 2019, at 12:51 PM, Eric Berman <notifications@github.com mailto:notifications@github.com> wrote:

Can't detect use of the back button (as far as I'm aware), and even so wouldn't want to do a refresh (page resubmit). I use the popups all over the place; this isn't unique to the edit page.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericberman/MyFlightbookWeb/issues/362?email_source=notifications&email_token=AEBRDEBY7J3P2JIGJ4RTWK3QGQQ33A5CNFSM4IPPXPDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5FJWEQ#issuecomment-524983058, or mute the thread https://github.com/notifications/unsubscribe-auth/AEBRDEAVV4GT2KZ2BNMELI3QGQQ33ANCNFSM4IPPXPDA.

ericberman commented 5 years ago

This appears with a hover, I don't follow the distinction you're drawing between pop-up and "action list" (is that referring to the set of items in the list?).

Everywhere on the site that you see a "v" is a pop-up, which displays on hover. That pop-up can contain...well, anything at all. Some of the stuff that's in there can be clicked and does a post-back to the same page; that does cause the page to be refreshed. But others are links to new pages, which cause a navigation. Edit, post to Facebook, repeat flight, request signature - all of these are simple links. Links are nice because they go directly to the requested page (done by the browser) without having to hit the site first (two site hits), and since they're always a "GET" they have nice semantics for previous/next button usage (no warning about resubmitting a form).

The bug here is that Safari is remembering the visibility state of the popup, which by definition should only be while hovering. That's Safari's bug.

ericberman commented 5 years ago

The stack overflow idea is an interesting approach, but (a) I'd have to do this on literally every page on the site that uses popups, and (b) using the cache is actually a good thing from a performance perspective.

KayRJay commented 5 years ago

The distinction is that for the action list, I actually DO click on an option in the list. The action list does disappear if I move the cursor without clicking. With the other pop-ups I looked at, there is nothing to click on. But yes, anywhere you could click on an item in a pop-up, the same behavior would occur.

On Aug 26, 2019, at 1:06 PM, Eric Berman notifications@github.com wrote:

This appears with a hover, I don't follow the distinction you're drawing between pop-up and "action list" (is that referring to the set of items in the list?).

Everywhere on the site that you see a "v" is a pop-up, which displays on hover. That pop-up can contain...well, anything at all. Some of the stuff that's in there can be clicked and does a post-back to the same page; that does cause the page to be refreshed. But others are links to new pages, which cause a navigation. Edit, post to Facebook, repeat flight, request signature - all of these are simple links. Links are nice because they go directly to the requested page (done by the browser) without having to hit the site first (two site hits), and since they're always a "GET" they have nice semantics for previous/next button usage (no warning about resubmitting a form).

The bug here is that Safari is remembering the visibility state of the popup, which by definition should only be while hovering. That's Safari's bug.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericberman/MyFlightbookWeb/issues/362?email_source=notifications&email_token=AEBRDED52MRQTLKOCQN2ZP3QGQSTPA5CNFSM4IPPXPDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5FLEDQ#issuecomment-524988942, or mute the thread https://github.com/notifications/unsubscribe-auth/AEBRDEBHR2WM5FDKGNZSVWDQGQSTPANCNFSM4IPPXPDA.

KayRJay commented 5 years ago

You’d only need to use that idea on pages that have pop-ups with lists, and then only after the user has actually clicked on an item in the list. There would be no performance hit in all other circumstances.

On Aug 26, 2019, at 1:09 PM, Eric Berman notifications@github.com wrote:

The stack overflow idea is an interesting approach, but (a) I'd have to do this on literally every page on the site that uses popups, and (b) using the cache is actually a good thing from a performance perspective.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericberman/MyFlightbookWeb/issues/362?email_source=notifications&email_token=AEBRDEGU7EWFFVRQ4EZJB6DQGQS6JA5CNFSM4IPPXPDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5FLMCQ#issuecomment-524989962, or mute the thread https://github.com/notifications/unsubscribe-auth/AEBRDECVDZGMCFEW5GLB2ALQGQS6JANCNFSM4IPPXPDA.

ericberman commented 5 years ago

Where do I have a pop-up that doesn't have anything to click on? Oh, are you referring to things like the "[?]" hint things I have around or the images? I'm talking about the ones with the "V"

LOT'S of pages have the pop-up menus; I can't tell if you're coming back because the user had clicked on an item.

KayRJay commented 5 years ago

Yeah, those little [?] and ▼ things that appear throughout.

You must know when a user clicks on an item in the pop-up list. Set a flag when that happens, and then use the stack overflow idea.

That would work, no?

On Aug 26, 2019, at 1:11 PM, Eric Berman notifications@github.com wrote:

Where do I have a pop-up that doesn't have anything to click on? Oh, are you referring to things like the "[?]" hint things I have around or the images? I'm talking about the ones with the "V"

LOT'S of pages have the pop-up menus; I can't tell if you're coming back because the user had clicked on an item.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericberman/MyFlightbookWeb/issues/362?email_source=notifications&email_token=AEBRDEEOYWYTBRVF7L5UYFLQGQTHNA5CNFSM4IPPXPDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5FLSYQ#issuecomment-524990818, or mute the thread https://github.com/notifications/unsubscribe-auth/AEBRDEBCKZ2STDFBTG3USHTQGQTHNANCNFSM4IPPXPDA.

ericberman commented 5 years ago

The [?] things indeed (generally) have nothing clickable inside. Pretty much everything else with a MenuChevron does have something clickable inside (I can't think of any off the top of my head that don't.)

Anyhow, clicks come in three flavors: local javascript, a postback and a navigate.

I can't tell if a link was contained within a pop-up control.

There are a bunch of truly hacky solutions I can do here, I think they're all risky and fragile:

What I might be able to do is have the pop-up menu control detect page transition and, if so, dismiss the pop-up before allowing the navigation to occur. I think I could do that centrally (in the pop-up code). Need to investigate.

KayRJay commented 5 years ago

As they say in pilot talk … “Roger”.

Thanks for investigating and educating me on how all this stuff works.

On Aug 26, 2019, at 1:31 PM, Eric Berman notifications@github.com wrote:

The [?] things indeed (generally) have nothing clickable inside. Pretty much everything else with a https://user-images.githubusercontent.com/16455286/63716660-5cd9b100-c7fb-11e9-98f8-4e57689d87ac.png does have something clickable inside (I can't think of any off the top of my head that don't.)

Anyhow, clicks come in three flavors: local javascript, a postback and a navigate.

local javascript just runs some code in the browser. Expanding/collapsing stuff is an example of that. The server is not involved. A postback does hit the server and comes back to the SAME page, and is done via HTTP POST (vs. HTTP GET) so I can (and do!) absolutely detect that as being an interaction with the page. But postbacks also don't have this bug. (Postbacks, by the way, are why the browser sometimes asks you if you want to resubmit a form when you hit the back button) A navigation click goes to the new page, but runs NO code on the existing page. The browser simply replaces the current page with the new page. This is where the issue is occurring. I can't tell if a link was contained within a pop-up control.

There are a bunch of truly hacky solutions I can do here, I think they're all risky and fragile:

I can replace all the navigation links to run javascript locally and then navigate. This touches an insane amount of code and is super fragile because if I add a new link inside a popup in the future, I may not remember to do it. I can do the stack overflow solution, limiting it to Safari and on-back, but I would need to do that on every page that contains a pop-up control (or contains a control that contains a pop-up control, which basically could be every page). Also touches a lot of code and dramatically reduces performance for Safari users (since it kills use of cache for most pages). What I might be able to do is have the pop-up menu control detect page transition and, if so, dismiss the pop-up before allowing the navigation to occur. I think I could do that centrally (in the pop-up code). Need to investigate.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericberman/MyFlightbookWeb/issues/362?email_source=notifications&email_token=AEBRDEHZ2TXCIZELASSDP4DQGQVRJA5CNFSM4IPPXPDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5FNKZA#issuecomment-524997988, or mute the thread https://github.com/notifications/unsubscribe-auth/AEBRDEHA3N6FT4C4B747WD3QGQVRJANCNFSM4IPPXPDA.

ericberman commented 5 years ago

My "might" seems to work. Register beforeunload event (only on safari) to clean up the popmenu.

ericberman commented 5 years ago

(Great bug, by the way. Wow.)

KayRJay commented 5 years ago

Great and quick fix! Thanks!