-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
amp-accordion
URL-based state initialization
#16110
Comments
|
/cc @cathyxz Adding an Whatever we do here will cause content shift unless it gets applies in v0.js ( even in that case, it will cause content shift in SSR-case unless integrated there as well ). Having the logic in v0 of course increases the side and SSR-integration increases complexity. So some impact analysis is needed before we make this change. Similar to other dynamic features, we will make the decision case-by-case if it endsup breaking AMP's UX principles. |
Wouldn't the content shift happen due to the cookie-based session state as well? Not sure what you mean by variable substitution, but I did try playing with an |
@jamesshannon It does happen with cookie-based session state already unfortunately. variable substitution is faster than One solution to the UX problem is doing something similar to resizing and deny the request if it causes jumps. With prerender, it would almost never be denied, without prerender, if below the fold it would work as well. That should cover vast majority of cases. |
This issue hasn't been updated in awhile. @aghassemi Do you have any updates? |
1 similar comment
This issue hasn't been updated in awhile. @aghassemi Do you have any updates? |
I've seen this requested a couple of times... I think there's even another issue for this. @nainar , do you think this could only be implemented in a way that caused content to shift? Or is there another way? |
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. |
This is somewhat similar to my other requests for URL-based state (for, e.g., carousel).
The use case is that there are a handful of accordions and each represents a different state on the page and should be configurable based on the URL (query param or hash). Based on a Google search this appears to be a pretty standard practice for accordions.
Without this the client plans on creating an AMP page and then duplicating it x times (for each accordion), so they'd have
page-optionA.html
,page-optionB.html
, etc.This request could be seen as two parts, which I break out because #1 is more urgent for the client right now.
amp-accordion
should be able to initialize state from the URL.I see that amp-accordion can initialize from a cookie state, so it seems that adding this would be pretty straightforward. I would suggest:
So it'd look like:
page.html#accordion_id-opened=pane1,pane5
The text was updated successfully, but these errors were encountered: