From ea260fef4f20ddb568b891559581505894568cd4 Mon Sep 17 00:00:00 2001 From: Nick Vincent Date: Fri, 4 Dec 2020 10:03:02 -0800 Subject: [PATCH 1/4] Bugfix: Revert iframe z-index to -1 in resize listener #5448 --- src/runtime/internal/dom.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index 91e575ebf630..dc5f7b75a8f3 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -261,7 +261,6 @@ export function is_crossorigin() { export function add_resize_listener(node: HTMLElement, fn: () => void) { const computed_style = getComputedStyle(node); - const z_index = (parseInt(computed_style.zIndex) || 0) - 1; if (computed_style.position === 'static') { node.style.position = 'relative'; @@ -270,7 +269,7 @@ export function add_resize_listener(node: HTMLElement, fn: () => void) { const iframe = element('iframe'); iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' + - `overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: ${z_index};` + `overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;` ); iframe.setAttribute('aria-hidden', 'true'); iframe.tabIndex = -1; From ed25c0bf1f1eae64cb0dab3fc58e309bfd3992e7 Mon Sep 17 00:00:00 2001 From: Nick Vincent Date: Fri, 4 Dec 2020 10:59:03 -0800 Subject: [PATCH 2/4] Interpolation no longer needed in this string --- src/runtime/internal/dom.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index dc5f7b75a8f3..8d99234c9de2 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -269,7 +269,7 @@ export function add_resize_listener(node: HTMLElement, fn: () => void) { const iframe = element('iframe'); iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' + - `overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;` + 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;' ); iframe.setAttribute('aria-hidden', 'true'); iframe.tabIndex = -1; From 112c51cb883cadbaf01188485c54292f1b187581 Mon Sep 17 00:00:00 2001 From: Nick Vincent Date: Sun, 6 Dec 2020 11:10:55 -0800 Subject: [PATCH 3/4] Add regression test for resize listener iframe z-index --- .../samples/binding-width-height-z-index/_config.js | 7 +++++++ .../samples/binding-width-height-z-index/main.svelte | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 test/runtime/samples/binding-width-height-z-index/_config.js create mode 100644 test/runtime/samples/binding-width-height-z-index/main.svelte diff --git a/test/runtime/samples/binding-width-height-z-index/_config.js b/test/runtime/samples/binding-width-height-z-index/_config.js new file mode 100644 index 000000000000..423289f8d382 --- /dev/null +++ b/test/runtime/samples/binding-width-height-z-index/_config.js @@ -0,0 +1,7 @@ +export default { + async test({ assert, target }) { + const iframe = target.querySelector('iframe'); + + assert.equal(iframe.style.zIndex, '-1'); + } +}; diff --git a/test/runtime/samples/binding-width-height-z-index/main.svelte b/test/runtime/samples/binding-width-height-z-index/main.svelte new file mode 100644 index 000000000000..bc14bd33f809 --- /dev/null +++ b/test/runtime/samples/binding-width-height-z-index/main.svelte @@ -0,0 +1,8 @@ + + +
+

Hello

+
From 80a2440adfe0edc29df53e6b3c08325519dce339 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 1 Jan 2021 20:52:30 -0500 Subject: [PATCH 4/4] fix indentation --- .../samples/binding-width-height-z-index/_config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/runtime/samples/binding-width-height-z-index/_config.js b/test/runtime/samples/binding-width-height-z-index/_config.js index 423289f8d382..c90dd8079b1e 100644 --- a/test/runtime/samples/binding-width-height-z-index/_config.js +++ b/test/runtime/samples/binding-width-height-z-index/_config.js @@ -1,7 +1,7 @@ export default { - async test({ assert, target }) { - const iframe = target.querySelector('iframe'); + async test({ assert, target }) { + const iframe = target.querySelector('iframe'); - assert.equal(iframe.style.zIndex, '-1'); - } + assert.equal(iframe.style.zIndex, '-1'); + } };