I2I: Consolidated 1.0
amp-facebook
#34969
Labels
INTENT TO IMPLEMENT
Proposes implementation of a significant new feature. https://bit.ly/amp-contribute-code
WG: bento
WG: components
Summary
This I2I proposes consolidating
amp-facebook:0.1
,amp-facebook-comments:0.1
,amp-facebook-like:0.1
, andamp-facebook-page:0.1
into a singleamp-facebook:1.0
component.Design Document
API impact
The
amp-facebook
component currently supports a requireddata-embed-as
attribute with valuepost|video|comment
. This proposal involves allowing three more embed types:comments|like|page
.All other pre-existing attributes on standalone components will be supported in
amp-facebook
. Invalid combinations of their existing attributes will behave as follows:data-*
attributes by defaultamp-facebook-page
, which will follow the same code path asamp-facebook[data-embed-as=page]
:amphtml/3p/facebook.js
Lines 145 to 160 in c194d57
The downside is that document authors will not be able to convert the import scripts for components from
0.1
to1.0
as the only migration action required. If this is an issue, we can consider publishing validamp-facebook-{comments,like,page}
with 1.0 versions which upgrade toamp-facebook[data-embed-as]
. These could also be transformed as such on the AMP cache.Attribute matrix
The follow table outlines the attributes current supported by each component individually.
amp-facebook
-comments
-like
-page
data-href
data-locale
title
data-allowfullscreen
data-embed-as
data-include-common-parent
data-colorscheme
data-numposts
data-orderby
data-action
data-kd_site
data-layout
data-ref
data-share
data-size
data-hide-cover
data-hide-cta
data-show-facepile
data-small-header
data-tabs
Behavior impact
The primary behavior change is that all embed types will now
attemptChangeHeight
, which impactsamp-facebook
andamp-facebook-comments
-- the only two components that would priorforceChangeHeight
and cause CLS regardless if it is pushing content down below it, potentially disrupting an end user's engagement with content. To be clear,amp-facebook-like
andamp-facebook-page
have always usedattemptChangeHeight
and would continue to do so as<amp-facebook data-embed-as="like">
and<amp-facebook data-embed-as="page">
. Examples would be provided in all use cases of how to provide anoverflow
element to solicit user interaction for resizing.amp-facebook
will also fail if itsdata-embed-as
attribute is not one of the six embed types, whereas prior it would restrict it to the existing three.Motivation
Without this change, AMP developers are forced to import up to 4 components scripts which all: preconnect to the Facebook SDK, create an iframe, and load our third-party Facebook integration code. They could get the same feature set with only one such component with negligible code additions to ensure compatibility and significant removals of redundant logic.
For publishers who only use one of these components on their document, the difference would be that this configuration object would have 15 more entries:
amphtml/extensions/amp-facebook/1.0/base-element.js
Lines 22 to 31 in c194d57
Alternative Solutions
We can do nothing and launch the four components as-is. The same features are available regardless, but publishers would see some non-optimized performance when using more than one of these on a single document. Namely, this includes downloading near-identical extension binaries in all cases and also downloading near-identical pre-upgrade CSS for non-AMP (Bento) use cases.
Launch Tracker
No response
Notifications
/cc @ampproject/wg-approvers @ampproject/wg-components
The text was updated successfully, but these errors were encountered: