History handling in AMP Pages
I have a popup form that needs to be closed on browser back. but the problem is i just want to close the form and not go back to the previous values of the states.
for example:
lets say I have a form Basic Details with fields Name, Age, Mobile: the user sets the data
i have another state isDataAvailable: used to keep track if the user has already filled the data
and a field IsBasicDetailsPopUpShown: flag to show the popup
Initially the states will be :
{'name':"",'age':"",'mobile':"","isDataAvailable":false,"isBasicDetailsPopUpShown":false}
when i want to show the popup, I use AMP.PushState
{'name':"",'age':"",'mobile':"","isDataAvailable":false,"isBasicDetailsPopUpShown":true}
and then when the user fills the data i use AMP.setState
{'name':"dummy",'age':"10",'mobile':"999234234","isDataAvailable":true,"isBasicDetailsPopUpShown":true}
now when the user clicks on browser back i want only the 'isBasicDetailsPopUpShown' to be set to false
now on browser back the history will be poped out and will result in
{'name':"",'age':"",'mobile':"","isDataAvailable":false,"isBasicDetailsPopUpShown":false}
thus losing the data. Is there anyway to get around it?
@choumx can you please help me?
@choumx any update on this?
@choumx can we do someting similar to what is done in amp-lightbox? is it possible to do it?
@choumx any suggestions on this?
@catherinehoule any suggestion on this?
@cw-ashish-sharma sorry for the delay, I'm sorry, off-hands I don't have a solution for you. I only worked on the accessibility part (mostly focus management) of the lightbox.
I have noticed that if we push a state that was previously not available and later when we do AMP.goBack we get that value. are we merging the states that were not there previously? for example: initial state
{
"name":"dummy",
}
we push another state via AMP.pushState
{
"name":"dummy_1",
"rollNo":56
}
now we do AMP.goBack()
the resulting state is
{
"name":"dummy",
"rollNo":56
}
is this correct and relevant?
@choumx @catherinehoule could you please direct me somewhere I could get a solution for this?
I’m sorry, I’m not working for amp. I just did a contribution to help accessibility on one component we were using...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.