Skip to content

Commit ad6c38c

Browse files
authored
Add controls attribute to <img>
Add a new `controls` attribute to the `img` element that allows the user agent to add an interactive user interface over the image. Animated images follow-up tracked by #12318. Fixes #11856.
1 parent 3fd7f35 commit ad6c38c

1 file changed

Lines changed: 31 additions & 3 deletions

File tree

source

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13727,7 +13727,7 @@ https://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%
1372713727
<li><code>details</code></li>
1372813728
<li><code>embed</code></li>
1372913729
<li><code>iframe</code></li>
13730-
<li><code>img</code> (if the <code data-x="attr-hyperlink-usemap">usemap</code> attribute is present)</li>
13730+
<li><code>img</code> (if the <code data-x="attr-hyperlink-usemap">usemap</code> or <code data-x="attr-img-controls">controls</code> attribute is present)</li>
1373113731
<li><code>input</code> (if the <code data-x="attr-input-type">type</code> attribute is <em>not</em> in the <span data-x="attr-input-type-hidden">Hidden</span> state)</li>
1373213732
<li><code>label</code></li>
1373313733
<li><code>select</code></li>
@@ -30804,7 +30804,7 @@ interface <dfn interface>HTMLSourceElement</dfn> : <span>HTMLElement</span> {
3080430804
<dd><span>Phrasing content</span>.</dd>
3080530805
<dd><span>Embedded content</span>.</dd>
3080630806
<dd><span>Form-associated element</span>.</dd>
30807-
<dd>If the element has a <code data-x="attr-hyperlink-usemap">usemap</code> attribute: <span>Interactive content</span>.</dd>
30807+
<dd>If the element has a <code data-x="attr-hyperlink-usemap">usemap</code> or <code data-x="attr-img-controls">controls</code> attribute: <span>Interactive content</span>.</dd>
3080830808
<dd><span>Palpable content</span>.</dd>
3080930809
<dt><span data-x="concept-element-contexts">Contexts in which this element can be used</span>:</dt>
3081030810
<dd>Where <span>embedded content</span> is expected.</dd>
@@ -30820,6 +30820,7 @@ interface <dfn interface>HTMLSourceElement</dfn> : <span>HTMLElement</span> {
3082030820
<dd><code data-x="attr-img-crossorigin">crossorigin</code></dd>
3082130821
<dd><code data-x="attr-hyperlink-usemap">usemap</code></dd>
3082230822
<dd><code data-x="attr-img-ismap">ismap</code></dd>
30823+
<dd><code data-x="attr-img-controls">controls</code></dd>
3082330824
<dd><code data-x="attr-dim-width">width</code></dd>
3082430825
<dd><code data-x="attr-dim-height">height</code></dd>
3082530826
<dd><code data-x="attr-img-referrerpolicy">referrerpolicy</code></dd>
@@ -30848,6 +30849,7 @@ interface <dfn interface>HTMLImageElement</dfn> : <span>HTMLElement</span> {
3084830849
[<span>CEReactions</span>] attribute DOMString? <span data-x="dom-img-crossOrigin">crossOrigin</span>;
3084930850
[<span>CEReactions</span>, <span data-x="xattr-Reflect">Reflect</span>] attribute DOMString <dfn attribute for="HTMLImageElement" data-x="dom-img-useMap">useMap</dfn>;
3085030851
[<span>CEReactions</span>, <span data-x="xattr-Reflect">Reflect</span>] attribute boolean <dfn attribute for="HTMLImageElement" data-x="dom-img-isMap">isMap</dfn>;
30852+
[<span>CEReactions</span>, <span data-x="xattr-Reflect">Reflect</span>] attribute boolean <dfn attribute for="HTMLImageElement" data-x="dom-img-controls">controls</dfn>;
3085130853
[<span>CEReactions</span>, <span data-x="xattr-ReflectSetter">ReflectSetter</span>] attribute unsigned long <span data-x="dom-img-width">width</span>;
3085230854
[<span>CEReactions</span>, <span data-x="xattr-ReflectSetter">ReflectSetter</span>] attribute unsigned long <span data-x="dom-img-height">height</span>;
3085330855
readonly attribute unsigned long <span data-x="dom-img-naturalWidth">naturalWidth</span>;
@@ -31198,6 +31200,29 @@ interface <dfn interface>HTMLImageElement</dfn> : <span>HTMLElement</span> {
3119831200
together with <code>source</code> elements with the <code data-x="attr-source-media">media</code>
3119931201
attribute specified in a <code>picture</code> element.</p>
3120031202

31203+
<p>The <dfn element-attr for="img"><code data-x="attr-img-controls">controls</code></dfn>
31204+
attribute is a <span>boolean attribute</span>. If present, it indicates that the user agent may
31205+
expose a user interface to the user.</p>
31206+
31207+
<div w-nodev>
31208+
31209+
<p>If the <code data-x="attr-img-controls">controls</code> attribute is present, the user agent
31210+
may expose controls over the image (e.g., a control for fullscreen viewing). The specific
31211+
controls provided are <span>implementation-defined</span>, and can be platform-specific or based
31212+
on the user's preferences.</p>
31213+
31214+
<p>If the user agent exposes a user interface by displaying controls over the <code>img</code>
31215+
element, then the user agent should suppress any user interaction events while the user agent is
31216+
interacting with this interface.</p>
31217+
31218+
<p class="XXX"><a href="https://github.com/whatwg/html/issues/12318">Issue #12318</a> tracks
31219+
the interaction between image controls and animated images. User agents should not expose
31220+
animation controls for images before that issue is resolved.</p>
31221+
31222+
</div>
31223+
31224+
<hr>
31225+
3120131226
<p>The <code>img</code> element supports <span>dimension
3120231227
attributes</span>.</p>
3120331228

@@ -152476,6 +152501,7 @@ interface <dfn interface>External</dfn> {
152476152501
<code data-x="attr-img-crossorigin">crossorigin</code>;
152477152502
<code data-x="attr-hyperlink-usemap">usemap</code>;
152478152503
<code data-x="attr-img-ismap">ismap</code>;
152504+
<code data-x="attr-img-controls">controls</code>;
152479152505
<code data-x="attr-dim-width">width</code>;
152480152506
<code data-x="attr-dim-height">height</code>;
152481152507
<code data-x="attr-img-referrerpolicy">referrerpolicy</code>;
@@ -153707,7 +153733,7 @@ interface <dfn interface>External</dfn> {
153707153733
<td>
153708153734
<code>a</code> (if the <code data-x="attr-hyperlink-href">href</code> attribute is present);
153709153735
<code>audio</code> (if the <code data-x="attr-media-controls">controls</code> attribute is present);
153710-
<code>img</code> (if the <code data-x="attr-hyperlink-usemap">usemap</code> attribute is present);
153736+
<code>img</code> (if the <code data-x="attr-hyperlink-usemap">usemap</code> or <code data-x="attr-img-controls">controls</code> attribute is present);
153711153737
<code>input</code> (if the <code data-x="attr-input-type">type</code> attribute is <em>not</em> in the <span data-x="attr-input-type-hidden">Hidden</span> state);
153712153738
<code>video</code> (if the <code data-x="attr-media-controls">controls</code> attribute is present)
153713153739

@@ -154116,6 +154142,7 @@ interface <dfn interface>External</dfn> {
154116154142
<th> <code data-x="">controls</code>
154117154143
<td> <code data-x="attr-media-controls">audio</code>;
154118154144
<code data-x="attr-media-controls">video</code>
154145+
<code data-x="attr-img-controls">img</code>;
154119154146
<td> Show user agent controls
154120154147
<td> <span>Boolean attribute</span>
154121154148
<tr>
@@ -158352,6 +158379,7 @@ INSERT INTERFACES HERE
158352158379
Yi-An Huang,
158353158380
Yngve Nysaeter Pettersen,
158354158381
Yoav Weiss,
158382+
Yoel Hawa, <!-- yoelhawa on GitHub -->
158355158383
Yonathan Randolph,
158356158384
Yu Huojiang,
158357158385
Yuki Okushi, <!-- JohnTitor on GitHub -->

0 commit comments

Comments
 (0)