W3C home > Mailing lists > Public > www-style@w3.org > August 2017

[css-sizing] Auto-resize iframes and textarea based on content

From: Craig Francis <craig@craigfrancis.co.uk>
Date: Thu, 31 Aug 2017 12:28:48 +0100
Message-Id: <43841253-DF74-48AF-A49F-0C41A3204355@craigfrancis.co.uk>
To: www-style list <www-style@w3.org>
Hi,

Just re-raising the suggestion of allowing an iframe or textarea to increase its height based on its content.

Mats Palmgren suggested that I raise this issue again, as Firefox is unlikely to implement it unless the CSSWG agrees to spec it.

For iframes, this feature would allow easy and secure (isolated) embedding of third party content without issues relating to scroll bars (i.e. needing custom JavaScript to ask the parent page, via postMessage, to change the iframe height).

For textrareas, this is just a convenience feature, as trying to get JavaScript to do this is tricky (e.g. the browser can automatically add/remove scroll bars, which can throw off the calculations).

When we discussed this last time (after the @seamless attribute on the <iframe> was removed from the WHATWG spec), it was suggested that we used:

iframe,
textrarea {
    height: max-content;
}

In the case of the iframe, the child page would need to send a HTTP header (e.g. Expose-Height-Cross-Origin: 1), so it does not leak information about that website (e.g. if the user is logged in).

Craig




PS: This has been discussed in a number of times before, the earliest one I've found is 16 years old:

https://bugzilla.mozilla.org/show_bug.cgi?id=80713 <https://bugzilla.mozilla.org/show_bug.cgi?id=80713>

And I've written up some notes about this feature, which includes the suggestion of using it for element height animation (e.g. disclosure widgets):

https://github.com/craigfrancis/iframe-height <https://github.com/craigfrancis/iframe-height>
Received on Thursday, 31 August 2017 11:29:20 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 31 August 2017 11:29:21 UTC