Bubble-Card icon indicating copy to clipboard operation
Bubble-Card copied to clipboard

Pop-up disables tab (subview type) back button

Open GGSSDD opened this issue 1 year ago • 14 comments

I have a dashboard with multiple tabs set as subview type. One of the tabs contains a pop-up card which is activated by a custom:button-card tap. Everything works great from this point of view, the pop-up behaves as expected. The problem is when i try to exit the tab and return to the main tab using the back button. It doesn’t happen if the pop-up was activated. I mean it happens but after a number of attempts and this number is strictly related to how many times the pop-up was activated without leaving the tab one way or another. For example, If i activate the pop-up once, then pressing the tab’s back button 1 times + 1 it returns to the main tab, if i activate the pop-up 5 times when in tab, then pressing the tab’s back button 5 times + 1 it returns to the main tab.

Any ideea what is causing this issue?

GGSSDD avatar Dec 04 '23 12:12 GGSSDD

Hi, have you changed back_open to true in the pop-ups options?

Because setting it to false should fix your issue.

Clooos avatar Dec 04 '23 12:12 Clooos

No… it was always set to false, still is… but the issue persists.

GGSSDD avatar Dec 04 '23 12:12 GGSSDD

I've just tried and it seems that I've broken this feature in the new releases, I will fix that.

Thanks for the feedback!

Clooos avatar Dec 04 '23 12:12 Clooos

Don’t worry… Thank you.

GGSSDD avatar Dec 04 '23 12:12 GGSSDD

The back_open feature was removed because it was interfering with the pop-ups core functionality. But I will add a feature to replace the action when the close button is pressed, could it be a solution for you?

Clooos avatar Jan 06 '24 11:01 Clooos

Hi, First of all I really appreciate your concern in the matter… as for our little problem, I’m not sure exactly how this would entirely solve the issue, considering the fact that the close button is rather optional. You may not always choose to press it, but rather let the pop-up close by itself, if specified.

GGSSDD avatar Jan 06 '24 21:01 GGSSDD

Any development on this issue :) ?

fredrikwestman92 avatar Apr 21 '24 13:04 fredrikwestman92

I might have an idea for how I can fix that, I will probably add a new setting for the pop-ups in the next release.

Clooos avatar Apr 21 '24 17:04 Clooos

I did make a few observations, but i know very little of front end development or the inner workings of your card, so really they are mostly speculatively. But if it's to any help, here are my 5 cents of how to solve it:

Seems to me that home assistant back button only trigger the native back functionality on your device, as I get exactly the same result as using the back button in android or back button on a browser/mouse on a desktop.

So if I had to press 5 times to leave the dashboard with the home assistant back button , I also had to press 5 times with my Android back button.

I noticed the url changes when you trigger a pop up. I am guessing as a part of the navigation. I am also guessing your exit/back button isn't truly a back button , but a Navigation button back to the original dashboard. Then it makes sense that the back buttons wouldn't work as you have sort of added to the browsing history, rather then reversed it.

Another thing I did notice is, if I press the device back button wirh a pop up open, it will go back to the original dashboard (with all the propper animations). And doing it this way does not trigger the bug.

So maybe this is the solution. Have the exit button trigger the device back functionality, the same way home assistants back buttons does. It should solve the simpler cases.

It leaves you with one edge case though:

If you want to go something like dashboard -> popup1 --> popup2-> dashboard. If the exit button is changed , pressing it as you want to go from popup2-> dashboard it would instead send you back to popup1.

Again I know very little of web development so don't know what is feasible. But speculating makes me think of a few ideas worth exploring on to solve it :

  1. Have navigating between pop ups happen in 2 steps. When you press on a new popup. You first navigate backwards to the dashboard and instantly load and navigate to the new popup. Maybe there are things like skiping loading the previous page, the dashboard, that one can do while stepping back to make it more efficient. That should solve it as you always navigate forward then back from every popup.

  2. During every "popup session" keep a count, x, of how many times the popup was changed without going back to the dashboard. Then when the exit button is pressed you requests to go back x amount of steps.

Again, just guessing here as I am not a front end developer in anyway. Hope it was of some help.

One super easy hack though if you want a quick temporary fix for the problem: add an option for the user to remove the exit button. Not really a nice solution, but hey, if you can't press the button, then it can't cause any problems either 🙃 The user can always use the device back button insteed 🙂

fredrikwestman92 avatar Apr 21 '24 22:04 fredrikwestman92

Hi, Any development on the subject? Can I help?

GGSSDD avatar Jul 17 '24 04:07 GGSSDD

Hi,

I just noticed that the last update made things even worse, related to the subject. The back button for the subview it's now useless. Once I open the pop-up, no matter how many times I press the back button it doesn't go back, it stays in the subview... and when closing the pop-up, pressing the back button reopens the pop-up.

Help please!

GGSSDD avatar Aug 24 '24 04:08 GGSSDD

I just ran into this issue using subviews too. The subview back button works fine until a BubbleCard popup is triggered, after which it will not work again until the page is reloaded

ChrisChapman avatar Sep 07 '24 15:09 ChrisChapman

Hi, I've tried and I was able to reproduce it, the new issue will be fixed in the next release.

Clooos avatar Sep 07 '24 15:09 Clooos

Hi, I've tried and I was able to reproduce it, the new issue will be fixed in the next release.

Your work is appreciated, thank you!

ChrisChapman avatar Sep 07 '24 22:09 ChrisChapman

Hi, I will close this issue, the solution is explained here:

https://github.com/Clooos/Bubble-Card/issues/590#issuecomment-2379802104

Clooos avatar Oct 04 '24 14:10 Clooos

Solved!

Thank you.

GGSSDD avatar Oct 05 '24 06:10 GGSSDD