-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new and update existing popover api docs #26413
Merged
wbamberg
merged 20 commits into
mdn:main
from
chrisdavidmills:popover-api-landing-page-etc
May 3, 2023
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4d0a06e
Add new and update existing popover api docs
chrisdavidmills ec71885
Merge branch 'main' into popover-api-landing-page-etc
wbamberg a0dcf4e
Merge branch 'main' into popover-api-landing-page-etc
chrisdavidmills 8129d92
fixes to attribute links
chrisdavidmills 4674aee
Merge branch 'popover-api-landing-page-etc' of github.com:chrisdavidm…
chrisdavidmills 9b99ebc
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills 6e74407
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills 1e13228
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills ff61422
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills e554a00
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills 8fd243e
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills 53335c1
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills 112dd50
Update files/en-us/web/api/popover_api/index.md
chrisdavidmills 4e63d38
Merge branch 'main' into popover-api-landing-page-etc
chrisdavidmills 4dd401b
Making fixes according to review comments
chrisdavidmills 4d9a331
couple of broken link fixes
chrisdavidmills 40266d0
folder casing fix
chrisdavidmills 8fd2d15
folder casing fix
chrisdavidmills c70e458
Updates to answer 2nd round of wbamberg comments
chrisdavidmills 63dc0bb
Merge branch 'main' into popover-api-landing-page-etc
chrisdavidmills File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this section say, somewhere, that the default value is "toggle"? And maybe that you therefore don't need the attribute if you just want "toggle" behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really good point; I have made sure that the default action is made clear in the main landing page, property pages, and equivalent HTML attribute sections