Skip to content

Commit f7d4eef

Browse files
authored
use iframe z-index: -1 in resize listener (#5742)
1 parent 1da4105 commit f7d4eef

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/runtime/internal/dom.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ export function is_crossorigin() {
261261

262262
export function add_resize_listener(node: HTMLElement, fn: () => void) {
263263
const computed_style = getComputedStyle(node);
264-
const z_index = (parseInt(computed_style.zIndex) || 0) - 1;
265264

266265
if (computed_style.position === 'static') {
267266
node.style.position = 'relative';
@@ -270,7 +269,7 @@ export function add_resize_listener(node: HTMLElement, fn: () => void) {
270269
const iframe = element('iframe');
271270
iframe.setAttribute('style',
272271
'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +
273-
`overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: ${z_index};`
272+
'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;'
274273
);
275274
iframe.setAttribute('aria-hidden', 'true');
276275
iframe.tabIndex = -1;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
async test({ assert, target }) {
3+
const iframe = target.querySelector('iframe');
4+
5+
assert.equal(iframe.style.zIndex, '-1');
6+
}
7+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script>
2+
let offsetWidth = 0;
3+
let offsetHeight = 0;
4+
</script>
5+
6+
<div style="z-index: 42;" bind:offsetHeight bind:offsetWidth>
7+
<h1>Hello</h1>
8+
</div>

0 commit comments

Comments
 (0)