diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/html/global_attributes%2Fpopover.html | |
new repository
Diffstat (limited to 'devdocs/html/global_attributes%2Fpopover.html')
| -rw-r--r-- | devdocs/html/global_attributes%2Fpopover.html | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/devdocs/html/global_attributes%2Fpopover.html b/devdocs/html/global_attributes%2Fpopover.html new file mode 100644 index 00000000..f2a8c05c --- /dev/null +++ b/devdocs/html/global_attributes%2Fpopover.html @@ -0,0 +1,65 @@ +<header><h1>popover</h1></header><div class="section-content"> +<p>The <code>popover</code> <a href="../global_attributes">global attribute</a> is used to designate an element as a popover element.</p> <p>Popover elements are hidden via <code>display: none</code> until opened via an invoking/control element (i.e. a <code><button></code> or <code><input type="button"></code> with a <a href="../element/button#popovertarget"><code>popovertarget</code></a> attribute) or a <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/showPopover"><code>HTMLElement.showPopover()</code></a> call.</p> <p>When open, popover elements will appear above all other elements in the <a href="https://developer.mozilla.org/en-US/docs/Glossary/Top_layer">top layer</a>, and won't be influenced by parent elements' <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/position"><code>position</code></a> or <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/overflow"><code>overflow</code></a> styling.</p> <p> A popover attribute can have values <a href="https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using#auto_state_and_light_dismiss"><code>"auto"</code></a> (default) or <a href="https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using#using_manual_popover_state"><code>"manual"</code></a>. Popovers that have the <code>auto</code> state can be "light dismissed" by selecting outside the popover area, and generally only allow one popover to be displayed on-screen at a time. By contrast, <code>manual</code> popovers must always be explicitly hidden, but allow for use cases such as nested popovers in menus. </p> <p>For detailed information on usage, see the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Popover_API">Popover API</a> landing page.</p> +</div> +<h2 id="examples">Examples</h2> +<div class="section-content"> +<p>The following will render a button which will open a popover element.</p> <div class="code-example"> +<p class="example-header"><span class="language-name">html</span></p> +<pre data-signature="7v3uh3jeL5lI4RisD3HJLrDXuIM+pPMWtwYF7G3ml10=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>button</span> <span class="token attr-name">popovertarget</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>my-popover<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Open Popover<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>button</span><span class="token punctuation">></span></span> + +<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">popover</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>my-popover<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Greetings, one and all!<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span> +</pre> +</div> <div class="notecard note" id="sect1"> <p><strong>Note:</strong> See our <a href="https://mdn.github.io/dom-examples/popover-api/" target="_blank">Popover API examples landing page</a> to access the full collection of MDN popover examples.</p> </div> +</div> +<h2 id="specifications">Specifications</h2> +<div class="_table"><table class="standard-table"> +<thead><tr><th scope="col">Specification</th></tr></thead> +<tbody><tr><td><a href="https://html.spec.whatwg.org/multipage/popover.html#the-popover-attribute">HTML Standard <br><small># the-popover-attribute</small></a></td></tr></tbody> +</table></div> +<h2 id="browser_compatibility">Browser compatibility</h2> +<div class="_table"><table> +<thead> +<tr id="bct-browser-type"> +<th></th> +<th colspan="6">Desktop</th> +<th colspan="6">Mobile</th> +</tr> +<tr id="bct-browsers"> +<th></th> +<th>Chrome</th> +<th>Edge</th> +<th>Firefox</th> +<th>Internet Explorer</th> +<th>Opera</th> +<th>Safari</th> +<th>WebView Android</th> +<th>Chrome Android</th> +<th>Firefox for Android</th> +<th>Opera Android</th> +<th>Safari on IOS</th> +<th>Samsung Internet</th> +</tr> +</thead> +<tbody><tr> +<th><code>popover</code></th> +<td class="bc-supports-yes">114</td> +<td class="bc-supports-yes">114</td> +<td class="bc-supports-yes">114</td> +<td class="bc-supports-no">No</td> +<td class="bc-supports-yes">100</td> +<td class="bc-supports-yes">17</td> +<td class="bc-supports-yes">114</td> +<td class="bc-supports-yes">114</td> +<td class="bc-supports-no">No</td> +<td class="bc-supports-no">No</td> +<td class="bc-supports-yes">17</td> +<td class="bc-supports-no">No</td> +</tr></tbody> +</table></div> +<h2 id="see_also">See also</h2> +<div class="section-content"><ul> <li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Popover_API">Popover API</a></li> </ul></div><div class="_attribution"> + <p class="_attribution-p"> + © 2005–2023 MDN contributors.<br>Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.<br> + <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/popover" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/popover</a> + </p> +</div> |
