From e45c22f39b910514cc8d622bc88d1751f77969a4 Mon Sep 17 00:00:00 2001 From: Filip Stanis Date: Tue, 25 Feb 2020 21:39:53 +0000 Subject: [PATCH] make controls always shown in amp for email (#25714) --- extensions/amp-carousel/0.1/base-carousel.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/amp-carousel/0.1/base-carousel.js b/extensions/amp-carousel/0.1/base-carousel.js index 02e005b57a00..45d4a44d42f4 100644 --- a/extensions/amp-carousel/0.1/base-carousel.js +++ b/extensions/amp-carousel/0.1/base-carousel.js @@ -15,6 +15,7 @@ */ import {Keys} from '../../../src/utils/key-codes'; import {Services} from '../../../src/services'; +import {isAmp4Email} from '../../../src/format'; import {toggleAttribute} from '../../../src/dom'; /** @@ -38,8 +39,11 @@ export class BaseCarousel extends AMP.BaseElement { /** @override */ buildCallback() { const input = Services.inputFor(this.win); + const doc = /** @type {!Document} */ (this.element.ownerDocument); this.showControls_ = - input.isMouseDetected() || this.element.hasAttribute('controls'); + isAmp4Email(doc) || + input.isMouseDetected() || + this.element.hasAttribute('controls'); if (this.showControls_) { this.element.classList.add('i-amphtml-carousel-has-controls');