メインコンテンツへスキップ

menuitem要素


1.仕様

MENUITEM要素は、
操作項目を
表します。

MENUITEM - X EMPTY -- menu item. (Void elements.) [None] --

menuitem

メニュー項目 (menu item)

HTML5.1 で追加, HTML5.2 で廃止の要素です。

種類
空要素

任意のコンテンツを持つことができない要素です。

カテゴリ

なし

使用できるコンテキスト
<menu>要素に 0個以上

<menu>要素に 0個以上を そのコンテンツとして、使用できます。

コンテンツモデル
何もない

要素のコンテンツモデルが「何もない」の場合、要素にはテキストノード (要素間の空白以外) と要素ノードが含まれていてはなりません。

タグの省略

終了タグはありません。

コンテンツ属性
グローバル属性 他
type属性
コマンドの種類
label属性
ユーザーに見えるラベル
icon属性
コマンドのアイコン
disabled属性
コマンドまたはコントロールが無効かどうか
checked属性
コマンドまたはコントロールがチェックされているかどうか
radiogroup属性
ラジオボタングループとして扱うコマンドのグループ名
default属性
コマンドをデフォルトコマンドとしてマークする
title属性
コマンドを説明するヒント
DOM インターフェイス
HTMLMenuItemElement
  1. [Exposed=Window]
  2. interface HTMLMenuItemElement : HTMLElement {
  3. [HTMLConstructor] constructor();
  4.  
  5. [CEReactions] attribute DOMString type;
  6. [CEReactions] attribute DOMString label;
  7. [CEReactions] attribute DOMString icon;
  8. [CEReactions] attribute boolean disabled;
  9. [CEReactions] attribute boolean checked;
  10. [CEReactions] attribute DOMString radiogroup;
  11. [CEReactions] attribute boolean boolean default;
  12. };
HTMLElement
  1. [Exposed=Window]
  2. interface HTMLElement : Element {
  3. [HTMLConstructor] constructor();
  4.  
  5. // metadata attributes
  6. [CEReactions] attribute DOMString title;
  7. [CEReactions] attribute DOMString lang;
  8. [CEReactions] attribute boolean translate;
  9. [CEReactions] attribute DOMString dir;
  10.  
  11. // user interaction
  12. [CEReactions] attribute (boolean or unrestricted double or DOMString)? hidden;
  13. [CEReactions] attribute DOMString inert;
  14. undefined click();
  15. [CEReactions] attribute DOMString accessKey;
  16. readonly attribute DOMString accessKeyLabel;
  17. [CEReactions] attribute boolean draggable;
  18. [CEReactions] attribute boolean spellcheck;
  19. [CEReactions] attribute DOMString writingSuggestions;
  20. [CEReactions] attribute DOMString autocapitalize;
  21.  
  22. [CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText;
  23. [CEReactions] attribute [LegacyNullToEmptyString] DOMString outerText;
  24.  
  25. ElementInternals attachInternals();
  26.  
  27. // The popover API
  28. undefined showPopover();
  29. undefined hidePopover();
  30. boolean togglePopover(optional boolean force);
  31. [CEReactions] attribute DOMString? popover;
  32. };
  33.  
  34. HTMLElement includes GlobalEventHandlers;
  35. HTMLElement includes ElementContentEditable;
  36. HTMLElement includes HTMLOrSVGElement;
Element
  1. [Exposed=Window]
  2. interface Element : Node {
  3. readonly attribute DOMString? namespaceURI;
  4. readonly attribute DOMString? prefix;
  5. readonly attribute DOMString localName;
  6. readonly attribute DOMString tagName;
  7.  
  8. [CEReactions] attribute DOMString id;
  9. [CEReactions] attribute DOMString className;
  10. [SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
  11. [CEReactions, Unscopable] attribute DOMString slot;
  12.  
  13. boolean hasAttributes();
  14. [SameObject] readonly attribute NamedNodeMap attributes;
  15. sequence<DOMString> getAttributeNames();
  16. DOMString? getAttribute(DOMString qualifiedName);
  17. DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
  18. [CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
  19. [CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
  20. [CEReactions] undefined removeAttribute(DOMString qualifiedName);
  21. [CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
  22. [CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
  23. boolean hasAttribute(DOMString qualifiedName);
  24. boolean hasAttributeNS(DOMString? namespace, DOMString localName);
  25.  
  26. Attr? getAttributeNode(DOMString qualifiedName);
  27. Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
  28. [CEReactions] Attr? setAttributeNode(Attr attr);
  29. [CEReactions] Attr? setAttributeNodeNS(Attr attr);
  30. [CEReactions] Attr removeAttributeNode(Attr attr);
  31.  
  32. ShadowRoot attachShadow(ShadowRootInit init);
  33. readonly attribute ShadowRoot? shadowRoot;
  34.  
  35. Element? closest(DOMString selectors);
  36. boolean matches(DOMString selectors);
  37. boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches
  38.  
  39. HTMLCollection getElementsByTagName(DOMString qualifiedName);
  40. HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
  41. HTMLCollection getElementsByClassName(DOMString classNames);
  42.  
  43. [CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // legacy
  44. undefined insertAdjacentText(DOMString where, DOMString data); // legacy
  45. };
GlobalEventHandlers
  1. interface mixin GlobalEventHandlers {
  2. attribute EventHandler onabort;
  3. attribute EventHandler onauxclick;
  4. attribute EventHandler onbeforeinput;
  5. attribute EventHandler onbeforematch;
  6. attribute EventHandler onbeforetoggle;
  7. attribute EventHandler onblur;
  8. attribute EventHandler oncancel;
  9. attribute EventHandler oncanplay;
  10. attribute EventHandler oncanplaythrough;
  11. attribute EventHandler onchange;
  12. attribute EventHandler onclick;
  13. attribute EventHandler onclose;
  14. attribute EventHandler oncontextlost;
  15. attribute EventHandler oncontextmenu;
  16. attribute EventHandler oncontextrestored;
  17. attribute EventHandler oncopy;
  18. attribute EventHandler oncuechange;
  19. attribute EventHandler oncut;
  20. attribute EventHandler ondblclick;
  21. attribute EventHandler ondrag;
  22. attribute EventHandler ondragend;
  23. attribute EventHandler ondragenter;
  24. attribute EventHandler ondragleave;
  25. attribute EventHandler ondragover;
  26. attribute EventHandler ondragstart;
  27. attribute EventHandler ondrop;
  28. attribute EventHandler ondurationchange;
  29. attribute EventHandler onemptied;
  30. attribute EventHandler onended;
  31. attribute OnErrorEventHandler onerror;
  32. attribute EventHandler onfocus;
  33. attribute EventHandler onformdata;
  34. attribute EventHandler oninput;
  35. attribute EventHandler oninvalid;
  36. attribute EventHandler onkeydown;
  37. attribute EventHandler onkeypress;
  38. attribute EventHandler onkeyup;
  39. attribute EventHandler onload;
  40. attribute EventHandler onloadeddata;
  41. attribute EventHandler onloadedmetadata;
  42. attribute EventHandler onloadstart;
  43. attribute EventHandler onmousedown;
  44. [LegacyLenientThis] attribute EventHandler onmouseenter;
  45. [LegacyLenientThis] attribute EventHandler onmouseleave;
  46. attribute EventHandler onmousemove;
  47. attribute EventHandler onmouseout;
  48. attribute EventHandler onmouseover;
  49. attribute EventHandler onmouseup;
  50. attribute EventHandler onpaste;
  51. attribute EventHandler onpause;
  52. attribute EventHandler onplay;
  53. attribute EventHandler onplaying;
  54. attribute EventHandler onprogress;
  55. attribute EventHandler onratechange;
  56. attribute EventHandler onreset;
  57. attribute EventHandler onresize;
  58. attribute EventHandler onscroll;
  59. attribute EventHandler onscrollend;
  60. attribute EventHandler onsecuritypolicyviolation;
  61. attribute EventHandler onseeked;
  62. attribute EventHandler onseeking;
  63. attribute EventHandler onselect;
  64. attribute EventHandler onslotchange;
  65. attribute EventHandler onstalled;
  66. attribute EventHandler onsubmit;
  67. attribute EventHandler onsuspend;
  68. attribute EventHandler ontimeupdate;
  69. attribute EventHandler ontoggle;
  70. attribute EventHandler onvolumechange;
  71. attribute EventHandler onwaiting;
  72. attribute EventHandler onwebkitanimationend;
  73. attribute EventHandler onwebkitanimationiteration;
  74. attribute EventHandler onwebkitanimationstart;
  75. attribute EventHandler onwebkittransitionend;
  76. attribute EventHandler onwheel;
  77. };
ElementContentEditable
  1. interface mixin ElementContentEditable {
  2. [CEReactions] attribute DOMString contentEditable;
  3. [CEReactions] attribute DOMString enterKeyHint;
  4. readonly attribute boolean isContentEditable;
  5. [CEReactions] attribute DOMString inputMode;
  6. };
HTMLOrSVGElement
  1. interface mixin HTMLOrSVGElement {
  2. [SameObject] readonly attribute DOMStringMap dataset;
  3. attribute DOMString nonce; // intentionally no [CEReactions]
  4.  
  5. [CEReactions] attribute boolean autofocus;
  6. [CEReactions] attribute long tabIndex;
  7. undefined focus(optional FocusOptions options = {});
  8. undefined blur();
  9. };
ARIA in HTML
暗黙的="menuitem" ARIAロール="No" aria-* 属性="GlobalAny"

暗黙的な ARIAセマンティクスは、role=menuitem です。

作成者は、暗黙的な ARIAセマンティクス, または HTML要素のネイティブセマンティクスを上書きしてはいけません。

グローバル aria-* 属性と、許可されたロールに適用される任意の aria-* 属性が記述できます。

レンダリング
ブロックボックス
リスト
  1. menuitem {
  2. display: list-item;
  3. text-align: match-parent;
  4. unicode-bidi: isolate;
  5. }
  6. menuitem[type=checkbox i], menuitem[type=radio i] {
  7. display: inline-block;
  8. }

CSS を大雑把に読むと、 ブロックレベルのブロックコンテナボックス(ブロックボックス)を生成します。(マーカーの分のコンテナボックスも生成します。) などになります。

説明
menuitem要素は、ユーザーがポップアップメニュー (コンテキストメニュー) から呼び出すことができるコマンドを表します。

menuitem要素は、ユーザーがポップアップメニュー(コンテキストメニュー)から呼び出すことができるコマンドを表します。
type, label, icon, disabled, checked, radiogroupの一つ以上を使うmenuitem要素は、新しいコマンドを定義します。
HTML5.1 で提案されただけで、HTML Living Standard で採用されておらず、対応しているブラウザもはないと思います。

  1. <!DOCTYPE html>
  2. <html lang="ja">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>menuitem要素の例 - (Example of menuitem element) | 離珠のHTMLでしぃ!</title>
  6. </head>
  7. <body>
  8. <h1>menuitem要素の例</h1>
  9. <img src="../Img/G01/cafeboard_106l.gif" alt="Cafe board" contextmenu="imiCmmenu">
  10. <menu type="context" id="imiCmmenu">
  11. <menuitem label="Pet the kittens" onclick="kittens.pet()">
  12. <menuitem label="Cuddle with the kittens" onclick="kittens.cuddle()">
  13. <menu label="Feed the kittens">
  14. <menuitem label="Fish" onclick="kittens.feed(fish)">
  15. <menuitem label="Chicken" onclick="kittens.feed(chicken)">
  16. </menu>
  17. </menu>
  18. <p>HTML5.1 にある例示されているソースコードを用いた提示です。
    対応しているブラウザーはないと思うのですが、一応の提示です。
    </p>
  19. <p>提示するにあたり、画像とかIDとかは、あえて変えています。</p>
  20. <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>
  21. </body>
  22. </html>

このサンプルへのリンクです。
(./exmenuitem.htm)

JSONデータ
JSON形式での、データのイメージです。
  1. {
  2. "menuitem": {
  3. "check": "2024-09-01",
  4. "group": "List",
  5. "element": "- X EMPTY -- menu item. (Void elements.) [None] --",
  6. "attlist": {
  7. "%Global;": "",
  8. "type": "CDATA #IMPLIED -- Type of command --",
  9. "label": "CDATA #IMPLIED -- User-visible label --",
  10. "icon": "CDATA #IMPLIED -- Icon for the command --",
  11. "disabled": "(disabled) #IMPLIED -- Whether the command or control is disabled --",
  12. "checked": "(checked) #IMPLIED -- Whether the command or control is checked --",
  13. "radiogroup": "CDATA #IMPLIED -- Name of group of commands to treat as a radio button group --",
  14. "default": "(default) #IMPLIED -- Mark the command as being a default command --",
  15. },
  16. "comment": "メニュー項目 (menu item)",
  17. "point": "ユーザーがポップアップメニュー (コンテキストメニュー) から呼び出すことができるコマンドを表します。",
  18. "description": [
  19. "ユーザーがポップアップメニュー(コンテキストメニュー)から呼び出すことができるコマンドを表します。",
  20. "type, label, icon, disabled, checked, radiogroupの一つ以上を使うmenuitem要素は、新しいコマンドを定義します。",
  21. "HTML5.1 で提案されただけで、HTML Living Standard で採用されておらず、対応しているブラウザもはないと思います。",
  22. ],
  23. "kind": "Void",
  24. "categories": "None",
  25. "used": "menu (menuitem)*",
  26. "contentmodel": "%Nothing",
  27. "tag": [
  28. "-",
  29. "X",
  30. ],
  31. "attributes": {
  32. "type": "コマンドの種類",
  33. "label": "ユーザーに見えるラベル",
  34. "icon": "コマンドのアイコン",
  35. "disabled": "コマンドまたはコントロールが無効かどうか",
  36. "checked": "コマンドまたはコントロールがチェックされているかどうか",
  37. "radiogroup": "ラジオボタングループとして扱うコマンドのグループ名",
  38. "default": "コマンドをデフォルトコマンドとしてマークする",
  39. "title": "コマンドを説明するヒント",
  40. },
  41. "dominterface": "HTMLMenuItemElement",
  42. "rendering": [
  43. "Lists",
  44. "Bidirectional",
  45. ],
  46. "reference": [
  47. {
  48. "title": "HTML Living Standard. 16.2 Non-conforming features.",
  49. "href": "https://html.spec.whatwg.org/multipage/obsolete.html#non-conforming-features",
  50. "heading": "HTML Living Standard. 16.2 Non-conforming features",
  51. "sub": "Last Updated 27 August 2024",
  52. },
  53. {
  54. "title": "HTML 5.1 W3C Recommendation. 4.11.4. The menuitem element. W3C Recommendation, 1 November 2016.",
  55. "href": "https://www.w3.org/TR/2016/REC-html51-20161101/interactive-elements.html#the-menuitem-element",
  56. "heading": "HTML 5.1 W3C 勧告. 4.11.4. The menuitem element",
  57. "sub": "W3C勧告、2016年11月1日",
  58. },
  59. {
  60. "title": "MDN Web Docs. HTML <menuitem>",
  61. "href": "https://developer.mozilla.org/ja/docs/Web/HTML/Element/menuitem",
  62. "heading": "<menuitem> - HTML: ハイパーテキストマークアップ言語 | MDN",
  63. },
  64. ],
  65. "version": {
  66. "first": "HTML5.1",
  67. "latest": "HTML5.1",
  68. },
  69. }
  70. }

注意: 簡易に描画する為に、各項目の後ろに , を付与しています。JSON の形式では、末尾の項目の後には , は付けません。

最終確認日

2024-09-01


2.使用できるコンテキスト

menuitem要素は、
menu要素に
使用できます。

<menuitem>要素が使用できるコンテキスト(Context文脈)は、<menu>要素コンテンツとしてです。

menu
menuitem
  1. <img src="../Img/G01/cafeboard_106l.gif" alt="Cafe board" contextmenu="XMNSAMPLE0201">
  2. <menu type="context" id="XMNSAMPLE0201">
  3. <menuitem label="Sample No.01" onclick="sample01()">
  4. <menuitem label="Sample No.02" onclick="sample02()">
  5. </menu>

<menu>要素のコンテンツの一部として、<menuitem>要素を配置している例です。


3.コンテンツモデル

menuitem要素は、
配置可能なコンテンツは
ありません。

<menuitem>要素子や子孫としてどのようなコンテンツ(Content内容) が含まれなければならないかというと、何もない」 (要素にはテキストノード(要素間の空白以外) と要素ノードが含まれていてはなりません。) です。

<menuitem>要素は、(内容コンテンツContent)を持つことができない空要素です。


4.コンテンツ属性

menuitem要素は、
グローバル属性と、
type属性,
label属性,
icon属性,
disabled属性,
checked属性,
radiogroup属性,
default属性 を
設定できます。

  1. <img src="../Img/G01/cafeboard_106l.gif" alt="Cafe board" contextmenu="imiCm400">
  2. <menu type="context" id="imiCm400">
  3. <menuitem label="sample01" onclick="alert('さんぷる1')">
  4. </menu>

この雛型の 3 行目のmenuitem要素を置き換えてデモとしています。

例示は、ただソースコードをそのまま記述しただけであり、menuitem要素に対応しているブラウザーは現在はないと思います。

例示では空要素のmenuitem要素として記述していますが、対応していない要素で通常要素として処理されているようです。

Cafe board

type属性

  1. <menuitem type="command" label="sample01" onclick="alert('さんぷる1')">

type属性 は、コマンドの種類を示します。関連するアクションを持つ通常のコマンドか、トグル可能な状態やオプションか、アイテムのリストから1つのアイテムを選択するかのいずれかです。

typeは、次のキーワード(keywords)と状態(states)を持つ列挙属性(enumerated attribute)です。

command
この要素は、関連するアクションを持つ通常のコマンドを表す。
checkbox
この要素は、トグルできる状態やオプションを表します。
radio
この要素は、アイテムのリストから1つのアイテムを選択することを表します。

列挙属性と呼ばれる一部の属性は、有限の状態セットを取ります。このような属性の状態は、属性の値、各属性の仕様で指定されたキーワード/状態マッピングのセット、および属性の仕様で指定できる 2 つの特殊な状態を組み合わせることによって生成されます。これらの特殊な状態は、無効な値のデフォルトと欠落した値のデフォルトです。
この属性の欠落値のデフォルトは command の状態です。

Cafe board

label属性

  1. <menuitem type="command" label="sample01" onclick="alert('さんぷる1')">

label属性 は、ユーザーに表示されるコマンド名を与える。この属性が指定された場合、その値は空文字列であってはなりません。

Cafe board

icon属性

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

icon属性 は、コマンドを表す画像を与えます。属性が指定された場合、属性の値は空白で囲まれた有効なURLでなければなりません。属性の値が空文字列でない場合、アイコンの絶対URLを取得するには、属性の値を要素からの相対値で解決しなければなりません。属性が存在しないか、属性値が空文字列であるか、属性値の解析に失敗した場合、アイコンは存在しません。

Cafe board

disabled属性

  1. <menuitem type="command" label="sample01" onclick="alert('さんぷる1')" disabled>

disabled属性 は、ブーリアン属性で、存在する場合、現在の状態ではコマンドが使用できないことを示す。

Cafe board

checked属性

  1. <menuitem type="checkbox" label="checkbox01" checked>
  2. <menuitem type="command" label="sample01" onclick="alert('さんぷる1')">

checked属性 は、ブーリアン属性で、存在すればコマンドが選択されていることを示します。type属性がCheckbox状態かRadio状態でない限り、この属性は省略されなければなりません。

Cafe board

radiogroup属性

  1. <menuitem type="radio" label="radio01" radiogroup="group01">
  2. <menuitem type="radio" label="radio02" radiogroup="group01">
  3. <menuitem type="command" label="sample01" onclick="alert('さんぷる1')">

radiogroup属性 は、type属性が値 「radio 」であるコマンドに対して、コマンド自身がトグルされる時にトグルされるコマンドのグループの名前を与えます。名前のスコープは親要素の子リストです。type属性がRadio状態でない限り、属性は省略されなければなりません。指定された場合、属性の値は空でない文字列でなければなりません。

Cafe board

default属性

  1. <menuitem type="command" label="sample01" onclick="alert('さんぷる1')" default>

default属性 は、もし存在すれば、ユーザーがメニューを使う代わりにメニューの主題を直接起動した場合に呼び出されるコマンドであることを示します。default属性は、ブーリアン属性です。

使い方が良くわかりません。

title属性

  1. <menuitem type="command" label="sample01" onclick="alert('さんぷる1')" title="これはソースコードの例示です。">

title属性 は、グローバル属性ですが、この要素に関する特別なセマンティクスがあります。title属性は、コマンドを説明するヒントを与えます。

Cafe board

5.DOM インターフェイス

menuitem要素を
直接表す
プロパティは
ありません。

menuitemを表すプロパティはないので、documentquerySelectorAll()メソッドで条件を絞って、要素のリストを取得する方法があります。この時に取得できるのはHTMLMenuItemElement オブジェクトのリストです。例では属性セレクタ要素セレクタ子結合子menu[id="imiCm500"] > menuitemと指定して、menuitemのリストを取得しています。documentgetElementById()メソッドmenuを取得してから、そのElementquerySelectorAll()メソッドを用いるとか、状況, 目的によりいろいろあります。

Cafe board

この例示のmenuitemは、
"〇〇"です。

  1. <img src="../Img/G01/cafeboard_106l.gif" alt="Cafe board" contextmenu="imiCm500">
  2. <menu type="context" id="imiCm500">
  3. <menuitem type="radio" label="radio01" radiogroup="group01"></menuitem>
  4. <menuitem type="radio" label="radio02" radiogroup="group01"></menuitem>
  5. <menuitem type="command" label="sample01" onclick="alert('さんぷる1')"></menuitem>
  6. </menu>
  7. <p>このページの説明は、
  8. "<code id="JHSAMPLE051">〇〇</code>"です。</p>
  9. <script>
  10. document.addEventListener("DOMContentLoaded", function() {
  11. var vaMenuitem = document.querySelectorAll("menu[id='imiCm500'] > menuitem");
  12. var vaText = '';
  13. for (var i = 0; i < vaMenuitem.length; i++){
  14. vsText = vsText + vaMenuitem[i].getAttribute("label") + ' ';
  15. }
  16. if (vsText) {
  17. document.getElementById("JHSAMPLE051").textContent = vsText;
  18. }
  19. });
  20. </script>

menuitemの一覧から、labelの値を取得する例です。例示で表示する為に、HTML文書の読み込みと解析が終了した時に処理するコードとしています。また、ブラウザが対応してない要素で空要素であるという事から、検証用として通常要素の様に閉じタグを記述しています。


6.アクセシビリティ

menuitem要素は、
メニューまたは
メニューバーに含まれる
選択肢セット内の
オプションです。

<menuitem>要素暗黙的なARIAセマンティクスは、role="menuitem" となります。
`menuitem` ロールは、次のようなランドマークを意味します:
メニューまたはメニューバーに含まれる選択肢セット内のオプションです。

作成者は、aria-disabled属性を使用してメニュー項目を無効化できます。メニュー項目aria-haspopup属性が true に設定されている場合、メニュー項目サブレベルメニューを起動するために使用できることを示し、作成者はメニュー項目アクティブ化されたときに新しいサブレベルメニューを表示するべきです。

関連ウィジェットであることを識別するため、作成者はメニュー項目が menu または menubar ロールを持つ要素によって所有されていることを確認しなければなりません。作成者は、セパレーターまたはネイティブマークアップ言語の同等のロールを持つ要素を使用して、メニュー項目セットに分割できます。

作成者が<menuitem>要素に明示的に指定可能なARIA ロール(役割)は以下のとおりです:
「役割なし」: 作成者は暗黙的な ARIA セマンティクスまたは HTML 要素のネイティブ セマンティクスを上書きしてはならないことを表します。

ARIA の状態プロパティについては、すべての要素で使用できるグローバル`aria-*` 属性に加えて、上記のロールに応じて使用可能な`aria-*` 属性が許可されます。


7.レンダリング

  1. menuitem {
  2. display: list-item;
  3. unicode-bidi: isolate;
  4. }
  5. menuitem[type=checkbox i],
  6. menuitem[type=radio i] {
  7. display: inline-block;
  8. }

menuitem要素は、ブロックレベルのブロックコンテナであるボックスを生成します。 (マーカーの分のコンテナボックスも生成します。)

ブロックフォーマットコンテキストに参加して、ブロックフォーマットコンテキストを継承, 確立します。もし、インラインフォーマットコンテキストに参加するコンテンツのみを含む場合は、新しいインラインフォーマットコンテキストを確立します。次に、すべてのインラインコンテンツをラップするルートインラインボックスも生成します。

unicode-bidi は、置換されない要素のレンダリングでの Bidirectional text(双方向テキスト) に於いての期待される仕様の様です。

type属性の値が checkbox, radio であるmenuitem要素は、インラインレベルのブロックコンテナボックス(インラインブロック)を生成します。

menuitem要素は HTML5.1 で仕様が記述されていますが、CSS でのレンダリングについての記述は見当たりません。例示などはあるので、そこから同等の描画の要素のレンダリングの記述から推測したのが、この記述となります。あくまで学習の参考までに。


8.気を付ける点

現行では、
ほとんど未対応の
要素です。

menuitemは、HTML5.1 で提案されましたが、HTML5.2 で廃止され、ほとんど対応したブラウザなどがありません。また、contextmenu属性も、HTML Living Standard では 不適合機能 と記されています。
よって、カスタムコンテキストメニューを実装するには、この要素, 属性はないものとして、Elementcontextmenuイベントを処理するスクリプトを使用します。