Re: [csswg-drafts] Prevent iframe from scrolling parent container (#7134)

Workaround for cases where you know when iframe will try to scroll parent:

1. Right before this event:
```ts
this.preScrollTop = window.scrollY;
this.prevPositionStyle = window.document.body.style.position ?? undefined;
window.document.body.style.position = 'fixed';
window.document.body.style.top = (this.preScrollTop * -1) + 'px';
```

2. After the event:
```ts
window.document.body.style.position = this.prevPositionStyle ?? 'static';
window.scroll({ top: this.preScrollTop });
```

-- 
GitHub Notification of comment by e-oz
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7134#issuecomment-2525149093 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 7 December 2024 13:53:39 UTC