A command is the abstraction behind menu items, buttons, and links. Once a command is defined, other parts of the interface can refer to the same command, allowing many access points to a single feature to share facets such as the Disabled State.
Commands are defined to have the following facets:
These facets are exposed on elements using the command API:
commandTypeExposes the Type facet of the command.
idExposes the ID facet of the command.
commandLabelExposes the Label facet of the command.
titleExposes the Hint facet of the command.
commandIconExposes the Icon facet of the command.
accessKeyLabelExposes the Access Key facet of the command.
commandHiddenExposes the facet of the command.
commandDisabledExposes the Disabled State facet of the command.
commandCheckedExposes the Checked State facet of the command.
click()Triggers the Action of the command.
commandsReturns an HTMLCollection
of the elements in the Document that define commands and have
IDs.
User agents may expose the commands whose
facet is false
(visible) and whose elements are in a Document. For example, such
commands could be listed in the user agent's menu bar. User agents
are encouraged to do this especially for commands that have
Access Keys, as a way to advertise
those keys to the user.
dialog elementdt element.th element.open
interface HTMLDialogElement : HTMLElement {
attribute boolean open;
attribute DOMString returnValue;
void show(optional (MouseEvent or Element) anchor);
void showModal(optional (MouseEvent or Element) anchor);
void close(optional DOMString returnValue);
};
The dialog element represents a part of an
application that a user interacts with to perform a task, for
example a dialog box, inspector, or window.
The open attribute is a boolean attribute. When specified, it
indicates that the dialog element is active and that the user
can interact with it.
show(
[ anchor ] )Displays the dialog element.
The argument, if provided, provides an anchor point to which the element will be fixed.
showModal( [ anchor ] )Displays the dialog element and makes it the top-most
modal dialog.
The argument, if provided, provides an anchor point to which the element will be fixed.
This method honors the autofocus attribute.
close(
[ result ] )Closes the dialog element.
The argument, if provided, provides a return value.
returnValue [ = result ]Returns the dialog's return value.
Can be set, to update the return value.
This section will eventually be moved to a CSS specification; it is specified here only on an interim basis until an editor can be found to own this.
| Value: | none | <position> |
|---|---|
| Initial: | none |
| Applies to: | all elements |
| Inherited: | no |
| Percentages: | refer to width or height of box; see prose |
| Media: | visual |
| Computed value: | The specified value, but with any lengths replaced by their corresponding absolute length |
| Animatable: | no |
| Canonical order: | per grammar |
The 'anchor-point' property specifies a point to which dialog boxes are to be aligned.
If the value is a <position>, the alignment point is the point given by the value, which must be interpreted relative to the element's first rendered box's margin box. Percentages must be calculated relative to the element's first rendered box's margin box (specifically, its width for the horizontal position and its height for the vertical position). [CSSVALUES] [CSS]
If the value is the keyword 'none', then no explicit alignment
point is defined. The user agent will pick an alignment point
automatically if necessary (as described in the definition of the
open()
method above).