diff --git a/docs/components/menu.md b/docs/components/menu.md index 32bacf4a55..e067d112e3 100644 --- a/docs/components/menu.md +++ b/docs/components/menu.md @@ -581,6 +581,8 @@ a sharp 0px border radius.](images/menu/theming.webp) | `disabled` | `disabled` | `boolean` | `false` | Disables the item and makes it non-selectable and non-interactive. | | `type` | `type` | `string` | `'menuitem'` | Sets the behavior and role of the menu item, defaults to "menuitem". | | `href` | `href` | `string` | `''` | Sets the underlying `HTMLAnchorElement`'s `href` resource attribute. | +| `download` | `download` | `string` | `''` | Sets the underlying `HTMLAnchorElement`'s `download` resource attribute. | +| `rel` | `rel` | `string` | `''` | Sets the underlying `HTMLAnchorElement`'s `rel` resource attribute. | | `target` | `target` | `string` | `''` | Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is set. | | `keepOpen` | `keep-open` | `boolean` | `false` | Keeps the menu open if clicked or keyboard selected. | | `selected` | `selected` | `boolean` | `false` | Sets the item in the selected visual state when a submenu is opened. | diff --git a/menu/internal/menuitem/menu-item.ts b/menu/internal/menuitem/menu-item.ts index 073308da51..7870901baa 100644 --- a/menu/internal/menuitem/menu-item.ts +++ b/menu/internal/menuitem/menu-item.ts @@ -55,6 +55,20 @@ export class MenuItemEl extends menuItemBaseClass implements MenuItem { */ @property() href = ''; + /** + * The filename to use when downloading the linked resource. + * If not specified, the browser will determine a filename. + * This is only applicable when the menu-item is used as a link (`href` is set). + */ + @property() download = ''; + + /** + * The relationship between the current document and the linked resource. + * If not specified, no `rel` attribute will be applied. + * This is only applicable when the menu-item is used as a link (`href` is set). + */ + @property() rel = ''; + /** * Sets the underlying `HTMLAnchorElement`'s `target` attribute when `href` is * set. @@ -143,6 +157,8 @@ export class MenuItemEl extends menuItemBaseClass implements MenuItem { // TODO(b/265339866): announce "button"/"link" inside of a list item. Until // then all are "menuitem" roles for correct announcement. const target = isAnchor && !!this.target ? this.target : nothing; + const download = isAnchor && !!this.download ? this.download : nothing; + const rel = isAnchor && !!this.rel ? this.rel : nothing; return staticHtml` <${tag} id="item" @@ -155,6 +171,8 @@ export class MenuItemEl extends menuItemBaseClass implements MenuItem { aria-haspopup=${(this as ARIAMixinStrict).ariaHasPopup || nothing} class="list-item ${classMap(this.getRenderClasses())}" href=${this.href || nothing} + download=${download} + rel=${rel} target=${target} @click=${this.menuItemController.onClick} @keydown=${this.menuItemController.onKeydown}