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

Allow for functional links in amp-accordion headers #9335

Merged
merged 21 commits into from May 26, 2017

Conversation

kmh287
Copy link
Contributor

@kmh287 kmh287 commented May 15, 2017

This PR allows links in accordion headers that can be pressed without expanding or collapsing the corresponding accordion section.

Fixes #7712

/to @aghassemi

@kmh287 kmh287 force-pushed the amp_accordion_header_links branch from 69970be to cc85994 Compare May 25, 2017 15:23
@kmh287 kmh287 changed the title [WIP] Allow for functional links and buttons in amp-accordion headers [WIP] Allow for functional links in amp-accordion headers May 25, 2017
@kmh287 kmh287 requested a review from aghassemi May 26, 2017 15:55
@kmh287 kmh287 changed the title [WIP] Allow for functional links in amp-accordion headers Allow for functional links in amp-accordion headers May 26, 2017
// for buttons and links, which should not have their default behavior
// overidden.
const target = dev().assertElement(event.target);
if (target.tagName != 'A') {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we support anything else here besides anchor tags?

// for on links, which should not have their default behavior
// overidden.
const target = dev().assertElement(event.target);
if (target.tagName != 'A') {
Copy link
Contributor

Choose a reason for hiding this comment

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

this may not work for image links (<a href><amp-img>...). I think we need to check all the ancestors of target up to the header element. ancestorElements(child, predicate) should help find it.

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.

Copy link
Contributor

@aghassemi aghassemi left a comment

Choose a reason for hiding this comment

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

lgtm

@kmh287
Copy link
Contributor Author

kmh287 commented May 26, 2017

Thanks!

@kmh287 kmh287 merged commit ec17a98 into ampproject:master May 26, 2017
@ericlindley-g
Copy link
Contributor

Nice—thanks for jumping in on this, @kmh287 ! /cc @camelburrito as FYI

@camelburrito
Copy link
Contributor

We should not be doing this in accordion, ideally what you need in #7712 could be achieved by using amp-selector. This goes against what an accordion is supposed to do.

Could you hold on this till Tuesday when i am back.
@ericlindley-g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants