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 byside content improvements #18962

Conversation

bysidedevel3rdparty
Copy link
Contributor

This PR implements improvements to amp-byside-content extension based on code review suggestions discussed on #12798 .

Also allow to set sandbox attribute in iframe if requested in component.

@@ -50,6 +50,7 @@ <h2>Fixed layout content</h2>
layout="fixed"
width="120"
height="40"
sandbox="allow-scripts allow-same-origin allow-popups"
Copy link
Contributor

Choose a reason for hiding this comment

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

why does this need to be exposed on the component? to the page author, the implementation details that this is an iframe should be irrelevant. Is there a single default the component can use? If not, under what conditions does the page author need to change them? ( and how would they know what to change them to?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @aghassemi, thanks for your comments. We are going to assume pre-defaults for the component and set iframe attributes automatically.

extensions/amp-byside-content/0.1/amp-byside-content.js Outdated Show resolved Hide resolved
this.element.setAttribute('scrolling', 'no');
}

if (!this.element.hasAttribute('frameborder')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto above, it is strange to expose iframe attributes on this component. why don't the defaults work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As above, we are now assuming defaults.

// On iOS the iframe at times fails to render inside the `overflow:auto`
// container. To avoid this problem, we set the `overflow:auto` property
// 1s later via `amp-active` class.
if (this.container_ != this.element) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we have been dealing with similar problems for scrollable areas in iOS. The 1000 timeout is arbitrary though. Maybe you wanna run this first time embed-size message is received.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied the same behaviour to when the embed-size message is received.

this.channel_ = (this.element.getAttribute('data-channel') || '');
this.lang_ = (this.element.getAttribute('data-lang') || DEFAULT_LANG_);
this.fid_ = (this.element.getAttribute('data-fid') || '');

this.isResizable_ = this.element.hasAttribute('resizable');
Copy link
Contributor

Choose a reason for hiding this comment

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

we really like to avoid sub-areas of page that are vertically scrollable. It created bad UX. May I ask why scrollable iframe is preferred to resized version in some situations in your case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed resizable custom property, always assume non scrollable.

* @param {!Element} element
* @return {!Element} The container or the iframe.
*/
function makeIOsScrollable(element) {
Copy link
Contributor

Choose a reason for hiding this comment

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

there shouldn't be a need for this or container_ anymore since iframe is now never scrollable. Also amp-active stuff should not be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. Updated code to remove the container_ and no longer use the amp-active class.

@aghassemi aghassemi merged commit 998e3e0 into ampproject:master Nov 13, 2018
Enriqe pushed a commit to Enriqe/amphtml that referenced this pull request Nov 28, 2018
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

4 participants