-
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 #1849
amp-accordion #1849
Conversation
Please elaborate description a bit and reference issue(s). Done |
if (event.target) { | ||
var headerElements = | ||
this.element.querySelectorAll('section > *:first-child'); | ||
for(var i=0; i< headerElements.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: space after for and i
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
5ae6c8b
to
3b5efa1
Compare
} | ||
/** @override */ | ||
isRelayoutNeeded() { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why isRelayoutNeeded? when we override this its usually because there's some work in layoutCallback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct removing the the commit.
69eeaed
to
7562c40
Compare
|
||
An accordion provides a way for viewers to have a glance at the outline of the content and jump to a section or their choice at their will. This would be extremely helpful for handheld mobile devices where even a couple of sentences in a section would lead to the viewer needing to scroll. | ||
|
||
#### Behavior |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add something about where the expand/collapse behavior is triggered? I assume it's the first child of a <section>
, which is considered the heading, but it wasn't clear to me from this doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
7562c40
to
c847de7
Compare
/* Add expand and collapse signs to the heading */ | ||
amp-accordion > section > *:first-child:after { | ||
position: absolute !important; | ||
content: '+'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to have +
defined right away? Maybe this should be left to the author?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Removed
c847de7
to
0fcbb96
Compare
@sriramkrish85 , can you designate this as an experiment until we've gotten a chance to work with it and make sure it meets publisher's needs? This is a standalone extension - as long it delivers what it tells in the readme file it should be fine. Developers could try and use this and send in their feedback and we can build incrementally. |
df5e3f4
to
3eb88e2
Compare
|
||
/** @override */ | ||
buildCallback() { | ||
/** @const @private {!NodeList} */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add experiment as requested by @ericlindley-g
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
921865d
to
aad6fb1
Compare
PTAL |
'Each section must have exactly two children. ' + | ||
'See https://github.com/ampproject/amphtml/blob/master/extensions/' + | ||
'amp-accordion/amp-accordion.md. Found in: %s', this.element); | ||
if (!this.isExperimentOn_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you doing this in the #forEach
loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved up
aad6fb1
to
1aae4ee
Compare
LGTM |
amp-accordion - experimental
An accordion provides a way for viewers to have a glance at the outline of the content and jump to a section or their choice at their will. This would be extremely helpful for handheld mobile devices where even a couple of sentences in a section would lead to the viewer needing to scroll.
Solves #1017 (without the async content loading)
Referencing #827 since Expando is a part of it's discussion.