I have a popup modal that I’m using to hold app search functionality in a single place. I’m opening it as a routable modal via routes.js
. The popup is working, but every router configuration I’ve tried creates back button issues.
I’d really like to use routable modals a lot since my app has common functionality (like search) that I need to invoke from many different places. Routable modals seem to be designed to handle this type of functionality, but I can’t get past the back button issues. See below:
CONFIGURATION 1:
{
path: '/search/',
popup: { component: SearchPopup },
},
Problem 1:
Back button on future pages stops working 1 page before starting point
To Reproduce:
- Go to
/home
- Click on
/search/
to open the search popup - Perform a search
- Click on search result to open
/item/x
- Once
/item/x
opens, click on a link to openitem/y
- Once
item/y
opens, click <Back (to get back to/item/x
) - Once
item/x
opens, click <Back (to get back to/home/
)
Issue:
Back button on /item/x
doesn’t work, no errors, just nothing
The /search/
modal is in router history, so I’m thinking that’s the problem.
Expected:
Back button on /item/x
should bring me back to my starting point /home/
CONFIGURATION 2:
{
path: '/search/',
popup: { component: SearchPopup },
options: { history: false },
},
Good News
Problem 1 is solved!
Problem 2.1:
Back button stops working after opening the search popup again on future pages
To Reproduce:
- Go to
/home/
- Click on
/search/
to open the search popup - Perform a search
- Click on search result to go to
/item/x
- Once
/item/x
opens, click on/search/
to open a new search popup - Perform a search
- Click on search result to go to
/item/y
- Once
item/y
opens, click <Back (to get back to/item/x
)
Issue:
Back button on /item/y
doesn’t work, no errors, just nothing
The /search/
modal is not in router history
Expected:
Back button on /item/y
should bring me back to previous page /item/x
Problem 2.2
All links on starting page stop working after opening and closing the search popup
To Reproduce:
- Go to
/home/
- Click on
/search/
to open the search popup - click <Back to close search popup and go back to home
- Click on any other link on
/home/
Issue:
Other links on /home/
don’t work
Error in console: Uncaught (in promise) Error: TypeError: Cannot read properties of undefined (reading 'animate') at component-loader.js:97:17
Expected:
Links on /home/
should still work after opening and closing search popup
Is there something I’m doing wrong in my configuration? I’ve read the documentation multiple times and can’t see anything that describes the correct configuration for reusable routable popups.