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

🐛 propagate title attribute in amp-iframe #27037

Merged
merged 17 commits into from
Mar 6, 2020

Conversation

maxlever
Copy link
Contributor

@maxlever maxlever commented Feb 29, 2020

Improve a11y by propagating title attribute from amp-iframe to iframe. Resolves #17308.

@maxlever maxlever marked this pull request as ready for review February 29, 2020 21:35
@amp-owners-bot amp-owners-bot bot requested a review from JonEleven February 29, 2020 21:35
@amp-owners-bot
Copy link

Hey @ampproject/wg-caching, these files were changed:

extensions/amp-iframe/validator-amp-iframe.protoascii

@maxlever maxlever changed the title 🐛add title attribute to amp-iframe validator 🐛add title attribute to amp-iframe validator Feb 29, 2020
@twifkak twifkak self-requested a review March 2, 2020 20:47
@honeybadgerdontcare honeybadgerdontcare added the WG: Caching: Triaged Initial triage from wg-caching complete. Remove label if new input required. label Mar 2, 2020
@twifkak twifkak removed their request for review March 2, 2020 20:53
@@ -618,6 +619,9 @@ export class AmpIframe extends AMP.BaseElement {
);
}
}
if (this.iframe_) {
this.propagateAttributes(['title'], this.iframe_);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i would ideally propagate all ATTRIBUTES_TO_PROPAGATE, but this was causing an e2e test error when I tried that, so only propagating title on mutate.

Copy link
Contributor

Choose a reason for hiding this comment

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

A comment here indicating why only title is propagated would be nice.

@maxlever maxlever changed the title 🐛add title attribute to amp-iframe validator 🐛 add title attribute to amp-iframe validator Mar 2, 2020
@maxlever maxlever changed the title 🐛 add title attribute to amp-iframe validator 🐛 propagate title attribute in amp-iframe Mar 2, 2020
Copy link
Contributor

@kristoferbaxter kristoferbaxter left a comment

Choose a reason for hiding this comment

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

Getting pretty close here, like the change to propagate the title mutation!

An additional test and a comment for the selective mutation transfer would be prudent.

@@ -46,6 +46,7 @@ const TAG_ = 'amp-iframe';

/** @const {!Array<string>} */
const ATTRIBUTES_TO_PROPAGATE = [
'title',
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: The rest of these appear to be alphabetised. Might want to keep the pattern up.

@@ -235,7 +236,8 @@ describes.realWin(
expect(iframe.getAttribute('referrerpolicy')).to.equal('no-referrer');
expect(iframe.getAttribute('frameborder')).to.equal('3');
expect(iframe.getAttribute('tabindex')).to.equal('-1');
// unsupproted attributes
expect(iframe.getAttribute('title')).to.equal('example title');
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add a test for when the title is mutated since this change is propagating it?

@@ -618,6 +619,9 @@ export class AmpIframe extends AMP.BaseElement {
);
}
}
if (this.iframe_) {
this.propagateAttributes(['title'], this.iframe_);
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment here indicating why only title is propagated would be nice.

@maxlever maxlever requested a review from kristoferbaxter March 2, 2020 22:53
@kristoferbaxter
Copy link
Contributor

Approved the visual diff change, and will look at the test addition in a few minutes.

Copy link
Contributor

@kristoferbaxter kristoferbaxter left a comment

Choose a reason for hiding this comment

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

Changes look good, thank you for contributing this fix!

@kristoferbaxter
Copy link
Contributor

@maxlever You might want to pull the amp-img changes into a seperate PR.

@maxlever
Copy link
Contributor Author

maxlever commented Mar 5, 2020

@kristoferbaxter i removed the amp-img changes -- is this okay to merge?

update: split amp-img changes into #27115.

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

Successfully merging this pull request may close these issues.

Enable [title] binding for amp-iframe
7 participants