Skip to content

Commit

Permalink
Disable overflow-x:hidden for WebView mode (#32232)
Browse files Browse the repository at this point in the history
* Disable overflow-x:hidden for WebView mode

* tests
  • Loading branch information
Dima Voytenko committed Jan 27, 2021
1 parent c357ab9 commit 02855b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
17 changes: 1 addition & 16 deletions css/ampdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,6 @@ html.i-amphtml-fie:not(.i-amphtml-inabox) > body {
}


/**
* Set `body {overflow-x: hidden}` for iOS WebView. This is b/c iOS WebView
* does NOT respect `html {overflow-x: hidden}`.
* Note! For all other natural cases body's style is `body {overflow: visible}`
* to avoid visibility issues with iframes.
*/
html.i-amphtml-webview > body {
overflow-x: hidden !important;
overflow-y: visible !important;
/* A <body> height of 0 will be hidden due to "overflow-x: hidden". */
/* Prevent this by setting min-height to 100vh. See b/74541306. */
min-height: 100vh !important;
}


/**
* iOS-Embed mode (iOS <= 8). The `body` itself is scrollable.
*/
Expand All @@ -124,7 +109,7 @@ html.i-amphtml-ios-embed {
position: static;
}

/** Wrapper for iOS Embed Wrapper mode. */
/** Wrapper for iOS Embed Wrapper mode (iOS <= 12). */
#i-amphtml-wrapper {
overflow-x: hidden !important;
overflow-y: auto !important;
Expand Down
4 changes: 2 additions & 2 deletions test/unit/test-viewport-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ describes.realWin('ViewportBindingNatural', {ampCss: true}, (env) => {
binding = new ViewportBindingNatural_(ampdoc);
const bodyStyles = win.getComputedStyle(win.document.body);
expect(bodyStyles.position).to.equal('relative');
expect(bodyStyles.overflowX).to.equal('hidden');
expect(bodyStyles.overflowY).to.not.equal('hidden');
expect(bodyStyles.overflowX).to.equal('visible');
expect(bodyStyles.overflowY).to.equal('visible');
});

it('should NOT require fixed layer transferring', () => {
Expand Down

0 comments on commit 02855b7

Please sign in to comment.