Skip to content
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

Merged
merged 1 commit into from
Feb 12, 2016
Merged

amp-accordion #1849

merged 1 commit into from
Feb 12, 2016

Conversation

camelburrito
Copy link
Contributor

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.

@cramforce
Copy link
Member

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++) {
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
/** @override */
isRelayoutNeeded() {
return true;
Copy link
Member

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

Copy link
Contributor Author

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.

@camelburrito camelburrito force-pushed the accordion branch 2 times, most recently from 69eeaed to 7562c40 Compare February 8, 2016 23:49

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
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/* Add expand and collapse signs to the heading */
amp-accordion > section > *:first-child:after {
position: absolute !important;
content: '+';
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Removed

@ericlindley-g
Copy link
Contributor

@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.

@camelburrito camelburrito force-pushed the accordion branch 2 times, most recently from df5e3f4 to 3eb88e2 Compare February 11, 2016 01:22

/** @override */
buildCallback() {
/** @const @private {!NodeList} */
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@camelburrito camelburrito force-pushed the accordion branch 3 times, most recently from 921865d to aad6fb1 Compare February 12, 2016 01:20
@camelburrito
Copy link
Contributor Author

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_) {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved up

@dvoytenko
Copy link
Contributor

LGTM

camelburrito pushed a commit that referenced this pull request Feb 12, 2016
@camelburrito camelburrito merged commit 82c2f4e into ampproject:master Feb 12, 2016
@camelburrito camelburrito deleted the accordion branch February 12, 2016 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants