Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build-system/global-configs/canary-config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"allow-doc-opt-in": ["amp-next-page"],
"allow-url-opt-in": [],
"amp-accordion-display-locking": 1,
"canary": 1,
"a4aProfilingRate": 0.01,
"adsense-ad-size-optimization": 1,
Expand Down
1 change: 0 additions & 1 deletion build-system/global-configs/prod-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"canary": 0,
"a4aProfilingRate": 0.01,
"adsense-ad-size-optimization": 1,
"amp-accordion-display-locking": 1,
"doubleclickSraExp": 0.01,
"doubleclickSraReportExcludedBlock": 0.1,
"expand-json-targeting": 1,
Expand Down
54 changes: 27 additions & 27 deletions build-system/tasks/visual-diff/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build-system/tasks/visual-diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0",
"description": "amp visual diff",
"devDependencies": {
"@percy/core": "1.0.0-beta.45",
"@percy/core": "1.0.0-beta.46",
"@percy/puppeteer": "2.0.0",
"puppeteer": "8.0.0"
}
Expand Down
5 changes: 0 additions & 5 deletions examples/accordion.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-accordion" src="https://cdn.ampproject.org/v0/amp-accordion-0.1.js"></script>
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>
<script>
(self.AMP = self.AMP || []).push(function(AMP) {
AMP.toggleExperiment('amp-accordion-display-locking', true);
});
</script>
<style amp-custom>
.menu {
padding: 1em;
Expand Down
9 changes: 0 additions & 9 deletions extensions/amp-accordion/0.1/amp-accordion.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ amp-accordion > section[expanded] > :last-child {
border: solid 1px #dfdfdf;
}

amp-accordion.i-amphtml-display-locking > section:not([expanded]) > :last-child,
amp-accordion.i-amphtml-display-locking
> section:not([expanded])
> :last-child
* {
content-visibility: hidden-matchable !important;
display: block !important;
}

/* Media should never play when a section is collapsed */
amp-accordion > section:not([expanded]) .i-amphtml-media-component,
amp-accordion > section:not([expanded]) .i-amphtml-media-component * {
Expand Down
12 changes: 0 additions & 12 deletions extensions/amp-accordion/0.1/amp-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {createCustomEvent} from '../../../src/event-helper';
import {dev, devAssert, user, userAssert} from '../../../src/log';
import {dict} from '../../../src/utils/object';
import {getStyle, setImportantStyles, setStyles} from '../../../src/style';
import {isExperimentOn} from '../../../src/experiments';
import {
numeric,
px,
Expand All @@ -42,10 +41,6 @@ const MIN_TRANSITION_DURATION = 200; // ms
const EXPAND_CURVE_ = bezierCurve(0.47, 0, 0.745, 0.715);
const COLLAPSE_CURVE_ = bezierCurve(0.39, 0.575, 0.565, 1);

const isDisplayLockingEnabledForAccordion = (win) =>
isExperimentOn(win, 'amp-accordion-display-locking') &&
win.document.body.onbeforematch !== undefined;

class AmpAccordion extends AMP.BaseElement {
/** @override @nocollapse */
static prerenderAllowed() {
Expand Down Expand Up @@ -183,13 +178,6 @@ class AmpAccordion extends AMP.BaseElement {

header.addEventListener('click', this.clickHandler_.bind(this));
header.addEventListener('keydown', this.keyDownHandler_.bind(this));

if (isDisplayLockingEnabledForAccordion(this.win)) {
this.element.classList.add('i-amphtml-display-locking');
content.addEventListener('beforematch', () => {
this.toggle_(section, ActionTrust.HIGH, /* force expand */ true);
});
}
});
}

Expand Down
20 changes: 0 additions & 20 deletions extensions/amp-accordion/0.1/test/test-amp-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
whenUpgradedToCustomElement,
} from '../../../../src/dom';
import {poll} from '../../../../testing/iframe';
import {toggleExperiment} from '../../../../src/experiments';

describes.realWin(
'amp-accordion',
Expand Down Expand Up @@ -201,25 +200,6 @@ describes.realWin(
expect(headerElements[1].getAttribute('aria-expanded')).to.equal('false');
});

it('should expand when beforematch event is triggered on a collapsed section', async () => {
// Enable display locking feature.
toggleExperiment(win, 'amp-accordion-display-locking', true);
doc.body.onbeforematch = null;
await getAmpAccordion();
const section = doc.querySelector('section:not([expanded])');
const header = section.firstElementChild;
const content = section.children[1];
expect(section.hasAttribute('expanded')).to.be.false;
expect(header.getAttribute('aria-expanded')).to.equal('false');
content.dispatchEvent(new Event('beforematch'));
expect(section.hasAttribute('expanded')).to.be.true;
expect(header.getAttribute('aria-expanded')).to.equal('true');

// Reset display locking feature
toggleExperiment(win, 'amp-accordion-display-locking', false);
doc.body.onbeforematch = undefined;
});

it(
"should trigger a section's expand event the section is expanded " +
'without animation',
Expand Down
14 changes: 0 additions & 14 deletions extensions/amp-accordion/1.0/amp-accordion.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,3 @@ amp-accordion
* {
display: none !important;
}

/* TODO: This CSS is duplicated from ./accordion.jss.js for purposes of display
* locking. Look into de-duping once experiment is launched.
*/
amp-accordion.i-amphtml-display-locking
> section:not([expanded])
> :last-child:not(.i-amphtml-animating),
amp-accordion.i-amphtml-display-locking
> section:not([expanded])
> :last-child:not(.i-amphtml-animating)
* {
content-visibility: hidden-matchable !important;
display: block !important;
}
14 changes: 1 addition & 13 deletions extensions/amp-accordion/1.0/amp-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ const TAG = 'amp-accordion';
class AmpAccordion extends BaseElement {
/** @override */
init() {
const props = super.init();

this.registerApiAction('toggle', (api, invocation) =>
api./*OK*/ toggle(invocation.args && invocation.args['section'])
);
Expand All @@ -42,17 +40,7 @@ class AmpAccordion extends BaseElement {
api./*OK*/ collapse(invocation.args && invocation.args['section'])
);

const {win} = this;
const displayLockingExperimentEnabled =
isExperimentOn(win, 'amp-accordion-display-locking') &&
win.document.body.onbeforematch !== undefined;

if (displayLockingExperimentEnabled) {
this.element.classList.add('i-amphtml-display-locking');
}

props['experimentDisplayLocking'] = displayLockingExperimentEnabled;
return props;
return super.init();
}

/** @override */
Expand Down
Loading