davidjbradshaw/iframe-resizer

Scrolling attribute is deprecated

yoyecros opened this issue · 8 comments

Describe the bug
The "scrolling" attribute is automatically added on the iframe tag, which is deprecated and causing accessibility issue.

To Reproduce
Just use the lib with any parameter

Expected behavior
Do not add deprecated attributes on the iframe tag

Screenshots
image

Desktop (please complete the following information):

  • OS: arch-linux
  • Browser: Firefox
  • Version: 110.0b9

Smartphone (please complete the following information):
Not used

Additional context
No additional context

You can disable it with scrolling: 'omit' option

Oh yes, it's working! Thanks :)

Hello, some update with this subject,
Using the scrolling: 'omit' option removes the attribute, but a scrollbar is shown in Chrome (we can't disable it, even with a overflow: hidder !important css rule)

Yep that's why we still add it, the CSS equivalent has never worked!

Closing, as although it is technically deprecated, there is still no official way to do this.

Any update on this issue? We are seeing unwanted scrollbars in iframe contents after recent chrome update v121.0.6167.185

@angular360 how are you calling iframe-resizer?

In summary my understanding of the issue is that the scrolling="no" attribute of the <iframe/> is still the only reliable way to disable a scrollbar. Whilst it has technically been deprecated for over a decade, the recommend alternative way of doing this via CSS has never worked and shows no signs of ever being fully supported in current browsers.

The only issue this really causes is that some dev code audit tools complain about a deprecated attribute, but this has no meaningful effect on user experience, so I would recommend just marking it as a false positive and moving on.

Version 5 of iframe-resizer will have a new option called offsetHeight which will allow you to modify the returned height from the iframe. However, to ensure that no scrollbars are ever displayed, if you omit the scrolling attribute on the iframe would require you to add an additional 10 to 20px to the height, which is likely to upset your design team.

If you would like to alpha test v5, then I would welcome any feedback you might have on it. The new version drops support for legacy browsers and should have much better performance, along with a much simpler API that can now auto select the best method of calculating the size of the content in the iframe. Please see #1212 for details on v5.