1.仕様
MENUITEM要素は、
操作項目を
表します。
MENUITEM - X EMPTY -- menu item. (Void elements.) [None] --
- menuitem
-
メニュー項目 (menu item)
HTML5.1 で追加, HTML5.2 で廃止の要素です。
以下の説明では、HTML Living Standard での解釈を想定して記述しています。 - 種類
-
空要素
任意のコンテンツを持つことができない要素です。
- カテゴリ
-
なし
- 使用できるコンテキスト
-
<menu>
要素 に 0個以上<menu>
要素 に 0個以上を そのコンテンツとして、使用できます。 - コンテンツモデル
-
何もない
要素のコンテンツモデルが「何もない」の場合、要素にはテキストノード (要素間の空白以外) と要素ノードが含まれていてはなりません。
- タグの省略
-
終了タグはありません。
- コンテンツ属性
-
グローバル属性 他
- type
属性 - コマンドの種類
- label
属性 - ユーザーに見えるラベル
- icon
属性 - コマンドのアイコン
- disabled
属性 - コマンドまたはコントロールが無効かどうか
- checked
属性 - コマンドまたはコントロールがチェックされているかどうか
- radiogroup
属性 - ラジオボタングループとして扱うコマンドのグループ名
- default
属性 - コマンドをデフォルトコマンドとしてマークする
- title
属性 - コマンドを説明するヒント
- type
- DOM インターフェイス
-
HTMLMenuItemElement
[Exposed=Window]
interface HTMLMenuItemElement : HTMLElement {
lastReviewed;
[HTMLConstructor] constructor();
[CEReactions] attribute DOMString type;
[CEReactions] attribute DOMString label;
[CEReactions] attribute DOMString icon;
[CEReactions] attribute boolean disabled;
[CEReactions] attribute boolean checked;
[CEReactions] attribute DOMString radiogroup;
[CEReactions] attribute boolean boolean default;
};
HTMLElement
[Exposed=Window]
interface HTMLElement : Element {
[HTMLConstructor] constructor();
// metadata attributes
[CEReactions] attribute DOMString title;
[CEReactions] attribute DOMString lang;
[CEReactions] attribute boolean translate;
[CEReactions] attribute DOMString dir;
// user interaction
[CEReactions] attribute (boolean or unrestricted double or DOMString)? hidden;
[CEReactions] attribute DOMString inert;
undefined click();
[CEReactions] attribute DOMString accessKey;
readonly attribute DOMString accessKeyLabel;
[CEReactions] attribute boolean draggable;
[CEReactions] attribute boolean spellcheck;
[CEReactions] attribute DOMString writingSuggestions;
[CEReactions] attribute DOMString autocapitalize;
[CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText;
[CEReactions] attribute [LegacyNullToEmptyString] DOMString outerText;
ElementInternals attachInternals();
// The popover API
undefined showPopover();
undefined hidePopover();
boolean togglePopover(optional boolean force);
[CEReactions] attribute DOMString? popover;
};
HTMLElement includes GlobalEventHandlers;
HTMLElement includes ElementContentEditable;
HTMLElement includes HTMLOrSVGElement;
Element
[Exposed=Window]
interface Element : Node {
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
readonly attribute DOMString tagName;
[CEReactions] attribute DOMString id;
[CEReactions] attribute DOMString className;
[SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
[CEReactions, Unscopable] attribute DOMString slot;
boolean hasAttributes();
[SameObject] readonly attribute NamedNodeMap attributes;
sequence<DOMString> getAttributeNames();
DOMString? getAttribute(DOMString qualifiedName);
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
[CEReactions] undefined removeAttribute(DOMString qualifiedName);
[CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
boolean hasAttribute(DOMString qualifiedName);
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
Attr? getAttributeNode(DOMString qualifiedName);
Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
[CEReactions] Attr? setAttributeNode(Attr attr);
[CEReactions] Attr? setAttributeNodeNS(Attr attr);
[CEReactions] Attr removeAttributeNode(Attr attr);
ShadowRoot attachShadow(ShadowRootInit init);
readonly attribute ShadowRoot? shadowRoot;
Element? closest(DOMString selectors);
boolean matches(DOMString selectors);
boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches
HTMLCollection getElementsByTagName(DOMString qualifiedName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
[CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // legacy
undefined insertAdjacentText(DOMString where, DOMString data); // legacy
};
GlobalEventHandlers
interface mixin GlobalEventHandlers {
attribute EventHandler onabort;
attribute EventHandler onauxclick;
attribute EventHandler onbeforeinput;
attribute EventHandler onbeforematch;
attribute EventHandler onbeforetoggle;
attribute EventHandler onblur;
attribute EventHandler oncancel;
attribute EventHandler oncanplay;
attribute EventHandler oncanplaythrough;
attribute EventHandler onchange;
attribute EventHandler onclick;
attribute EventHandler onclose;
attribute EventHandler oncontextlost;
attribute EventHandler oncontextmenu;
attribute EventHandler oncontextrestored;
attribute EventHandler oncopy;
attribute EventHandler oncuechange;
attribute EventHandler oncut;
attribute EventHandler ondblclick;
attribute EventHandler ondrag;
attribute EventHandler ondragend;
attribute EventHandler ondragenter;
attribute EventHandler ondragleave;
attribute EventHandler ondragover;
attribute EventHandler ondragstart;
attribute EventHandler ondrop;
attribute EventHandler ondurationchange;
attribute EventHandler onemptied;
attribute EventHandler onended;
attribute OnErrorEventHandler onerror;
attribute EventHandler onfocus;
attribute EventHandler onformdata;
attribute EventHandler oninput;
attribute EventHandler oninvalid;
attribute EventHandler onkeydown;
attribute EventHandler onkeypress;
attribute EventHandler onkeyup;
attribute EventHandler onload;
attribute EventHandler onloadeddata;
attribute EventHandler onloadedmetadata;
attribute EventHandler onloadstart;
attribute EventHandler onmousedown;
[LegacyLenientThis] attribute EventHandler onmouseenter;
[LegacyLenientThis] attribute EventHandler onmouseleave;
attribute EventHandler onmousemove;
attribute EventHandler onmouseout;
attribute EventHandler onmouseover;
attribute EventHandler onmouseup;
attribute EventHandler onpaste;
attribute EventHandler onpause;
attribute EventHandler onplay;
attribute EventHandler onplaying;
attribute EventHandler onprogress;
attribute EventHandler onratechange;
attribute EventHandler onreset;
attribute EventHandler onresize;
attribute EventHandler onscroll;
attribute EventHandler onscrollend;
attribute EventHandler onsecuritypolicyviolation;
attribute EventHandler onseeked;
attribute EventHandler onseeking;
attribute EventHandler onselect;
attribute EventHandler onslotchange;
attribute EventHandler onstalled;
attribute EventHandler onsubmit;
attribute EventHandler onsuspend;
attribute EventHandler ontimeupdate;
attribute EventHandler ontoggle;
attribute EventHandler onvolumechange;
attribute EventHandler onwaiting;
attribute EventHandler onwebkitanimationend;
attribute EventHandler onwebkitanimationiteration;
attribute EventHandler onwebkitanimationstart;
attribute EventHandler onwebkittransitionend;
attribute EventHandler onwheel;
};
ElementContentEditable
interface mixin ElementContentEditable {
[CEReactions] attribute DOMString contentEditable;
[CEReactions] attribute DOMString enterKeyHint;
readonly attribute boolean isContentEditable;
[CEReactions] attribute DOMString inputMode;
};
HTMLOrSVGElement
interface mixin HTMLOrSVGElement {
[SameObject] readonly attribute DOMStringMap dataset;
attribute DOMString nonce; // intentionally no [CEReactions]
[CEReactions] attribute boolean autofocus;
[CEReactions] attribute long tabIndex;
undefined focus(optional FocusOptions options = {});
undefined blur();
};
- ARIA in HTML
-
暗黙的="
No
" ARIAロール="menuitem
" aria-* 属性="GlobalAny
"暗黙的な ARIAセマンティクスがありませんが、意味はあり、この意味は、ARIA によって提供されず、ARIA のユーザーに公開されていないロール、状態、プロパティで表現される可能性があります。
ARIA in HTML に、この要素の記述はありません。HTML5.1 に記されている仕様です。作成者が要素に指定してもよい ARIAロール値は、menuitem です。
グローバル aria-* 属性と、許可されたロールに適用される任意の aria-* 属性が記述できます。
- レンダリング
- ブロック
ボックス リスト
menuitem {
display: list-item;
text-align: match-parent;
unicode-bidi: isolate;
}
menuitem[type=checkbox i], menuitem[type=radio i] {
display: inline-block;
}
CSS を大雑把に読むと、 ブロックレベルのブロックコンテナボックス(ブロックボックス)を生成します。(マーカーの分のコンテナボックスも生成します。) などになります。
- 説明
-
menuitem
要素 は、ユーザーがポップアップメニュー (コンテキストメニュー) から呼び出すことができるコマンドを表します。menuitem
要素 は、ユーザーがポップアップメニュー(コンテキストメニュー)から呼び出すことができるコマンドを表します。
type, label, icon, disabled, checked, radiogroupの一つ以上を使うmenuitem要素は、新しいコマンドを定義します。
HTML5.1 で提案されただけで、HTML Living Standard で採用されておらず、対応しているブラウザもはないと思います。<!DOCTYPE html>
<html lang=
"ja"> <head>
<meta charset=
"utf-8"> <title>
menuitem要素の例 - (Example of menuitem element) | 離珠のHTMLでしぃ!</title> <meta name=
"author" content= "コータン (KOUTAN)"> <link rel=
"icon" href= "../favicon.ico" type= "image/vnd.microsoft.icon"> </head>
<body>
<h1>
menuitem要素の例</h1> <img src=
"../Img/G01/cafeboard_106l.gif" alt= "Cafe board" contextmenu= "imiCmmenu"> <menu type=
"context" id= "imiCmmenu"> <menuitem label=
"Pet the kittens" onclick= "kittens.pet()"> <menuitem label=
"Cuddle with the kittens" onclick= "kittens.cuddle()"> <menu label=
"Feed the kittens"> <menuitem label=
"Fish" onclick= "kittens.feed(fish)"> <menuitem label=
"Chicken" onclick= "kittens.feed(chicken)"> </menu>
</menu>
<p>
HTML5.1 にある例示されているソースコードを用いた提示です。
対応しているブラウザーはないと思うのですが、一応の提示です。</p><p>
提示するにあたり、画像とかIDとかは、あえて変えています。</p> <a style=
"word-break: break-all" href= "https://www.w3.org/TR/2016/REC-html51-20161101/interactive-elements.html#example-e5c085bb" target= "_top"> https://www.w3.org/TR/2016/REC-html51-20161101/interactive-elements.html#example-e5c085bb</a> </body>
</html>
このサンプルへのリンクです。
(./exmenuitem.htm) - 参照元
-
参照元
- HTML Living Standard. 16.2 Non-conforming features (最終更新日 2025年8月29日)
- HTML 5.3 W3C 初公開ワーキングドラフト. 11.2. Non-conforming features (W3Cワーキングドラフト、2017年12月14日)
- HTML 5.2 W3C 勧告. 11.2. Non-conforming features (W3C勧告、2017年12月14日)
- HTML 5.1 W3C 勧告. 4.11.4. The menuitem element (W3C勧告、2016年11月1日)
- <menuitem> - HTML: ハイパーテキストマークアップ言語 | MDN
- JSONデータ
-
JSON形式での、データのイメージです。
{
"menuitem": {
"group": "Lists",
"element": "- X EMPTY -- menu item. (Void elements.) [None] --",
"attlist": {
"%Global;": "",
"type": "CDATA #IMPLIED -- Type of command --",
"label": "CDATA #IMPLIED -- User-visible label --",
"icon": "CDATA #IMPLIED -- Icon for the command --",
"disabled": "(disabled) #IMPLIED -- Whether the command or control is disabled --",
"checked": "(checked) #IMPLIED -- Whether the command or control is checked --",
"radiogroup": "CDATA #IMPLIED -- Name of group of commands to treat as a radio button group --",
"default": "(default) #IMPLIED -- Mark the command as being a default command --",
},
"summary": "メニュー項目 (menu item)",
"point": "ユーザーがポップアップメニュー (コンテキストメニュー) から呼び出すことができるコマンドを表します。",
"description": [
"ユーザーがポップアップメニュー(コンテキストメニュー)から呼び出すことができるコマンドを表します。",
"type, label, icon, disabled, checked, radiogroupの一つ以上を使うmenuitem要素は、新しいコマンドを定義します。",
"HTML5.1 で提案されただけで、HTML Living Standard で採用されておらず、対応しているブラウザもはないと思います。",
],
"elementKind": "Void",
"categories": "None",
"canUsedContexts": "menu (menuitem)*",
"contentModel": "%Nothing",
"tagOmission": [
"-",
"X",
],
"rendering": [
"Lists",
"Bidirectional",
],
"domInterface": "HTMLMenuItemElement",
"contentAttributes": {
"type": "コマンドの種類",
"label": "ユーザーに見えるラベル",
"icon": "コマンドのアイコン",
"disabled": "コマンドまたはコントロールが無効かどうか",
"checked": "コマンドまたはコントロールがチェックされているかどうか",
"radiogroup": "ラジオボタングループとして扱うコマンドのグループ名",
"default": "コマンドをデフォルトコマンドとしてマークする",
"title": "コマンドを説明するヒント",
},
"reference": [
{
"title": "HTML Living Standard. 16.2 Non-conforming features. Last Updated 29 August 2025",
"href": "https://html.spec.whatwg.org/multipage/obsolete.html#non-conforming-features",
"heading": "HTML Living Standard. 16.2 Non-conforming features",
"sub": "最終更新日 2025年8月29日",
},
{
"title": "HTML 5.3 W3C Working Draft. 11.2. Non-conforming features. W3C First Public Working Draft, 14 December 2017",
"href": "https://www.w3.org/TR/2017/WD-html53-20171214/obsolete.html#non-conforming-features",
"heading": "HTML 5.3 W3C 初公開ワーキングドラフト. 11.2. Non-conforming features",
"sub": "W3Cワーキングドラフト、2017年12月14日",
},
{
"title": "HTML 5.2 W3C Recommendation. 11.2. Non-conforming features. W3C Recommendation, 14 December 2017.",
"href": "https://www.w3.org/TR/2017/REC-html52-20171214/obsolete.html#non-conforming-features",
"heading": "HTML 5.2 W3C 勧告. 11.2. Non-conforming features",
"sub": "W3C勧告、2017年12月14日",
},
{
"title": "HTML 5.1 W3C Recommendation. 4.11.4. The menuitem element. W3C Recommendation, 1 November 2016.",
"href": "https://www.w3.org/TR/2016/REC-html51-20161101/interactive-elements.html#the-menuitem-element",
"heading": "HTML 5.1 W3C 勧告. 4.11.4. The menuitem element",
"sub": "W3C勧告、2016年11月1日",
},
{
"title": "MDN Web Docs. HTML <menuitem>",
"href": "https://developer.mozilla.org/ja/docs/Web/HTML/Element/menuitem",
"heading": "<menuitem> - HTML: ハイパーテキストマークアップ言語 | MDN",
},
],
"version": {
"first": "HTML5.1",
"latest": "HTML5.1",
},
"lastReviewed": "2025-08-31",
"obsoleteAttributes": [
],
}
}
注意: 簡易に描画する為に、各項目の後ろに
,
を付与しています。JSON の形式では、末尾の項目の後には,
は付けません。 - 最終確認日
-
2025-08-31
2.使用できるコンテキスト
menuitem要素は、
menu要素に
使用できます。
<menuitem>
<img src=
"../Img/G01/cafeboard_106l.gif" alt= "Cafe board" contextmenu= "XMNSAMPLE0201"> <menu type=
"context" id= "XMNSAMPLE0201"> <menuitem label=
"Sample No.01" onclick= "sample01()"> <menuitem label=
"Sample No.02" onclick= "sample02()"> </menu>
<menu>
3.コンテンツモデル
menuitem要素は、
配置可能なコンテンツは
ありません。
<menuitem>
<menuitem>
4.コンテンツ属性
menuitem要素は、
グローバル属性と、
type属性,
label属性,
icon属性,
disabled属性,
checked属性,
radiogroup属性,
default属性 を
配置できます。
<menuitem>
<img src=
"../Img/G01/cafeboard_106l.gif" alt= "Cafe board" contextmenu= "XMNCM400"> <menu type=
"context" id= "XMNCM400"> <menuitem label=
"sample01" onclick= "alert('さんぷる0')"> </menu>
この雛型の 3 行目の<menuitem>
雛型を元に複数の例示を併記しているので、ID は、それぞれ書き換えて一意にしています。
例示は、ただソースコードをそのまま記述しただけであり、<menuitem>
例示では空要素の<menuitem>
尚、<img>

type属性
<menuitem type=
"command" label="sample01" onclick= "alert('さんぷる1')">
type
type
- command
- この要素は、関連するアクションを持つ通常のコマンドを表す。
- checkbox
- この要素は、トグルできる状態やオプションを表します。
- radio
- この要素は、アイテムのリストから1つのアイテムを選択することを表します。
列挙属性と呼ばれる一部の属性は、有限の状態セットを取ります。このような属性の状態は、属性の値、各属性の仕様で指定されたキーワード/状態マッピングのセット、および属性の仕様で指定できる 2 つの特殊な状態を組み合わせることによって生成されます。これらの特殊な状態は、無効な値のデフォルトと欠落した値のデフォルトです。
この属性の欠落値のデフォルトは command の状態です。

label属性
<menuitem type=
"command" label= "sample01" onclick="alert('さんぷる2')">
label

icon属性
<menuitem type=
"command" icon= "../Img/G01/hatena01k.gif" onclick="alert('さんぷる3')">
icon

disabled属性
<menuitem type=
"command" label= "sample01" disabled onclick= "alert('さんぷる4')">
disabled

checked属性
<menuitem type=
"checkbox" label= "checkbox01" checked> <menuitem type=
"command" label= "sample01" disabled onclick= "alert('さんぷる5')">
checked

radiogroup属性
<menuitem type=
"radio" label= "radio01" radiogroup= "group01" ><menuitem type=
"radio" label= "radio02" radiogroup= "group01" ><menuitem type=
"command" label= "sample01" disabled onclick= "alert('さんぷる6')">
radiogroup

default属性
<menuitem type=
"command" label= "sample01" default onclick= "alert('さんぷる7')">
default
使い方が良くわかりません。
title属性
<menuitem type=
"command" label= "sample01" title= "これはソースコードの例示です。" onclick="alert('さんぷる8')">
title

5.DOM インターフェイス
menuitem要素を、
直接表す
プロパティは
ありません。
<menuitem>document
のquerySelectorAll()メソッドで条件を絞って、要素のリストを取得する方法があります。この時に取得できるのはHTMLMenuItemElement インターフェイスのリストです。例では属性menu[id="XMNCM501"] > menuitem
と指定して、menuitemのリストを取得しています。documentのgetElementById()メソッドでmenuを取得してから、そのElementのquerySelectorAll()メソッドを用いるとか、状況, 目的によりいろいろあります。

この例示のmenuitemのラベルは、
"〇〇
"です。
<img src=
"../Img/G01/cafeboard_106l.gif" alt= "Cafe board" contextmenu= "XMNCM501"> <menu type=
"context" id= "XMNCM501"> <menuitem type=
"command" label= "sample01" onclick= "alert('さんぷる501a')"> </menuitem> <menuitem type=
"command" label= "sample02" onclick= "alert('さんぷる501b')"> </menuitem> <menuitem type=
"command" label= "sample03" onclick= "alert('さんぷる501c')"> </menuitem> </menu>
<p>
この例示のmenuitemのラベルは、 "<code id=
"JCD501"> 〇〇</code>"です。</p> <script>
document
.addEventListener( "DOMContentLoaded", function() { let _llJsMenuitem = document
.querySelectorAll( ;"menu[id='XMNCM501'] > menuitem") let _lsJsText = '';
for (var _lnJsIdx = 0; _lnJsIdx < _llJsMenuitem
.length; _lnJsIdx++) { _lsJsText = _lsJsText + _llJsMenuitem[_lnJsIdx]
.getAttribute( "label") + ' '; }
document
.getElementById( "JCD501") .textContent = _lsJsText; });
</script>
menuitemの一覧から、label
6.アクセシビリティ
menuitem要素の
暗黙的な
ARIAセマンティクスは
ありません。
<menuitem>No corresponding role
とマークされている要素は、ARIAの暗黙的なセマンティクスを持ちませんが、意味を持ちます。この意味は、ARIAでは提供されていないロール、ステート、プロパティで表現され、アクセシビリティ
<menuitem>
作成者が<menuitem>menuitem
です。
ARIA の状態とプロパティについては、すべての要素で使用できるグローバル
<menuitem>
7.レンダリング
menuitem {
display: list-item;
unicode-bidi: isolate;
}
menuitem[type=checkbox i], menuitem[type=radio i] {
display: inline-block;
}
<menuitem>
ブロック
unicode-bidi
は、置換されない要素のレンダリングでの Bidirectional text(双方向テキスト) に於いての期待される仕様の様です。
type
※ <menuitem>
8.気を付ける点
現行では、
ほとんど未対応の
要素です。
<menuitem>
よって、カスタムコンテキストメニューを実装するには、この要素, 属性はないものとして、Elementのcontextmenuイベントを処理するスクリプトを使用します。