HTML5 MathML
HTML5 MathML <maction> Tag
The <maction> element binds an interactive action - such as toggling between two expressions - to part of a formula. It is a legacy interactivity element from earlier MathML versions and has limited support in modern MathML Core browsers.
Definition and Usage
The <maction> element wraps one or more sub-expressions and declares an action, chosen with the actiontype attribute, to perform on them. Historic values include toggle (cycle through children on click), statusline and tooltip. The selection attribute records which child is currently shown.
Syntax
<maction actiontype="toggle" selection="1">
<mn>1</mn>
<mn>2</mn>
</maction>Attributes
| Attribute | Description |
|---|---|
| actiontype | The kind of action, e.g. toggle, statusline or tooltip. |
| selection | 1-based index of the child currently displayed (for toggle). |
Example
The document shows the intended structure. Even where the toggle action is not implemented, the selected child renders, so a formula still appears.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MathML maction</title>
</head>
<body>
<p>Expression using maction:</p>
<math display="block">
<maction actiontype="toggle" selection="1">
<mrow>
<mi>a</mi><mo>+</mo><mi>b</mi>
</mrow>
<mrow>
<mi>b</mi><mo>+</mo><mi>a</mi>
</mrow>
</maction>
</math>
</body>
</html><maction> is not part of the MathML Core baseline and most modern browsers ignore its interactivity, rendering only the selected child. For real interactivity, use JavaScript to swap MathML on click.
Key Takeaways
- <maction> attaches an action such as toggle to a sub-expression.
- actiontype sets the behaviour; selection chooses the visible child.
- Interactivity is largely unsupported in MathML Core - use it only as a fallback container.
