-
Notifications
You must be signed in to change notification settings - Fork 22.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new and update existing popover api docs (#26413)
* Add new and update existing popover api docs * fixes to attribute links * Update files/en-us/web/api/popover_api/index.md Co-authored-by: wbamberg <[email protected]> * Update files/en-us/web/api/popover_api/index.md Co-authored-by: wbamberg <[email protected]> * Update files/en-us/web/api/popover_api/index.md Co-authored-by: wbamberg <[email protected]> * Update files/en-us/web/api/popover_api/index.md Co-authored-by: wbamberg <[email protected]> * Update files/en-us/web/api/popover_api/index.md Co-authored-by: wbamberg <[email protected]> * Update files/en-us/web/api/popover_api/index.md Co-authored-by: wbamberg <[email protected]> * Update files/en-us/web/api/popover_api/index.md Co-authored-by: wbamberg <[email protected]> * Update files/en-us/web/api/popover_api/index.md Co-authored-by: wbamberg <[email protected]> * Making fixes according to review comments * couple of broken link fixes * folder casing fix * folder casing fix * Updates to answer 2nd round of wbamberg comments --------- Co-authored-by: wbamberg <[email protected]>
- Loading branch information
1 parent
a6744d7
commit 559c464
Showing
31 changed files
with
1,211 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: Top layer | ||
slug: Glossary/Top_layer | ||
page-type: glossary-definition | ||
--- | ||
|
||
The **top layer** is a specific layer in the [stacking context](/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context), which spans the entire width and height of the viewport and sits on top of all other layers displayed in a web document. It is created by the browser to contain elements that should appear on top of all other content on the page. | ||
|
||
Elements that will appear in the top layer include: | ||
|
||
- Fullscreen elements, i.e. elements that have been caused to display in fullscreen mode by a successful {{domxref("Element.requestFullscreen()")}} call. | ||
- {{htmlelement("dialog")}} elements displayed as a modal via a successful {{domxref("HTMLDialogElement.showModal()")}} call. | ||
- Popover elements shown via a successful {{domxref("HTMLElement.showPopover()")}} call. | ||
|
||
The following screenshot demonstrates how a shown popover element is placed in the top layer in Chrome: | ||
|
||
![An element in the top layer, as shown in the chrome devtools](top_layer_devtools.png) | ||
|
||
## See also | ||
|
||
- [The stacking context](/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context) | ||
- [The Fullscreen API](/en-US/docs/Web/API/Fullscreen_API) | ||
- [The Popover API](/en-US/docs/Web/API/Popover_API) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
files/en-us/web/api/htmlbuttonelement/popovertargetaction/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
title: "HTMLButtonElement: popoverTargetAction property" | ||
short-title: popoverTargetAction | ||
slug: Web/API/HTMLButtonElement/popoverTargetAction | ||
page-type: web-api-instance-property | ||
status: | ||
- experimental | ||
browser-compat: api.HTMLButtonElement.popoverTargetAction | ||
--- | ||
|
||
{{ APIRef("DOM") }}{{SeeCompatTable}} | ||
|
||
The **`popoverTargetAction`** property of the {{domxref("HTMLButtonElement")}} interface gets and sets the action to be performed (`"hide"`, `"show"`, or `"toggle"`) on a popover element being controlled by a control button. | ||
|
||
It reflects the value of the [`popovertargetaction`](/en-US/docs/Web/HTML/Element/button#popovertargetaction) HTML attribute. | ||
|
||
## Value | ||
|
||
An enumerated value. Possible values are: | ||
|
||
- `"hide"` | ||
- : The button will hide a shown popover. If you try to hide an already hidden popover, no action will be taken. | ||
- `"show"` | ||
- : The button will show a hidden popover. If you try to show an already showing popover, no action will be taken. | ||
- `"toggle"` | ||
- : The button will toggle a popover between showing and hidden. if the popover is hidden, it will be shown; if the popover is showing, it will be hidden. If `popoverTargetAction` is not set, `"toggle"` is the default action that will be performed by the control button. | ||
|
||
## Examples | ||
|
||
```js | ||
function supportsPopover() { | ||
return HTMLElement.prototype.hasOwnProperty("popover"); | ||
} | ||
|
||
const popover = document.getElementById("mypopover"); | ||
const toggleBtn = document.getElementById("toggleBtn"); | ||
|
||
const popoverSupported = supportsPopover(); | ||
|
||
if (popoverSupported) { | ||
popover.popover = "auto"; | ||
toggleBtn.popoverTargetElement = popover; | ||
toggleBtn.popoverTargetAction = "toggle"; | ||
} else { | ||
console.log("Popover API not supported."); | ||
} | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- [Popover API](/en-US/docs/Web/API/Popover_API) |
52 changes: 52 additions & 0 deletions
52
files/en-us/web/api/htmlbuttonelement/popovertargetelement/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
title: "HTMLButtonElement: popoverTargetElement property" | ||
short-title: popoverTargetElement | ||
slug: Web/API/HTMLButtonElement/popoverTargetElement | ||
page-type: web-api-instance-property | ||
status: | ||
- experimental | ||
browser-compat: api.HTMLButtonElement.popoverTargetElement | ||
--- | ||
|
||
{{ APIRef("DOM") }}{{SeeCompatTable}} | ||
|
||
The **`popoverTargetElement`** property of the {{domxref("HTMLButtonElement")}} interface gets and sets the popover element to control via a control button. | ||
|
||
It is the JavaScript equivalent of the [`popovertarget`](/en-US/docs/Web/HTML/Element/button#popovertarget) HTML attribute. | ||
|
||
## Value | ||
|
||
A reference to a popover element in the DOM. | ||
|
||
## Examples | ||
|
||
```js | ||
function supportsPopover() { | ||
return HTMLElement.prototype.hasOwnProperty("popover"); | ||
} | ||
|
||
const popover = document.getElementById("mypopover"); | ||
const toggleBtn = document.getElementById("toggleBtn"); | ||
|
||
const popoverSupported = supportsPopover(); | ||
|
||
if (popoverSupported) { | ||
popover.popover = "auto"; | ||
toggleBtn.popoverTargetElement = popover; | ||
toggleBtn.popoverTargetAction = "toggle"; | ||
} else { | ||
console.log("Popover API not supported."); | ||
} | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- [Popover API](/en-US/docs/Web/API/Popover_API) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.