Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: unmatched div tag in menu-item.template.ts #6848

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,72 +21,76 @@ export function menuItemTemplate<T extends FASTMenuItem>(
options: MenuItemOptions = {}
): ElementViewTemplate<T> {
return html<T>`
<template
aria-haspopup="${x => (x.hasSubmenu ? "menu" : void 0)}"
aria-checked="${x => (x.role !== MenuItemRole.menuitem ? x.checked : void 0)}"
aria-disabled="${x => x.disabled}"
aria-expanded="${x => x.expanded}"
@keydown="${(x, c) => x.handleMenuItemKeyDown(c.event as KeyboardEvent)}"
@click="${(x, c) => x.handleMenuItemClick(c.event as MouseEvent)}"
@mouseover="${(x, c) => x.handleMouseOver(c.event as MouseEvent)}"
@mouseout="${(x, c) => x.handleMouseOut(c.event as MouseEvent)}"
>
${when(
x => x.role === MenuItemRole.menuitemcheckbox,
html<FASTMenuItem>`
<div part="input-container" class="input-container">
<span part="checkbox" class="checkbox">
<slot name="checkbox-indicator">
${staticallyCompose(options.checkboxIndicator)}
</slot>
</span>
</div>
`
)}
<template
aria-haspopup="${x => (x.hasSubmenu ? "menu" : void 0)}"
aria-checked="${x => (x.role !== MenuItemRole.menuitem ? x.checked : void 0)}"
aria-disabled="${x => x.disabled}"
aria-expanded="${x => x.expanded}"
@keydown="${(x, c) => x.handleMenuItemKeyDown(c.event as KeyboardEvent)}"
@click="${(x, c) => x.handleMenuItemClick(c.event as MouseEvent)}"
@mouseover="${(x, c) => x.handleMouseOver(c.event as MouseEvent)}"
@mouseout="${(x, c) => x.handleMouseOut(c.event as MouseEvent)}"
>
<div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The div is an unnecessary wrapper element and should be removed. If the item is in checkbox or radio mode there will be the input-container element which serves the same purpose.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, understood I have pushed a new commit, thanks for guidance!

${when(
x => x.role === MenuItemRole.menuitemcheckbox,
html<FASTMenuItem>`
<div part="input-container" class="input-container">
<span part="checkbox" class="checkbox">
<slot name="checkbox-indicator">
${staticallyCompose(options.checkboxIndicator)}
</slot>
</span>
</div>
`
)}
${when(
x => x.role === MenuItemRole.menuitemradio,
html<FASTMenuItem>`
<div part="input-container" class="input-container">
<span part="radio" class="radio">
<slot name="radio-indicator">
${staticallyCompose(options.radioIndicator)}
</slot>
</span>
</div>
`
)}
</div>
${startSlotTemplate(options)}
<span class="content" part="content">
<slot></slot>
</span>
${endSlotTemplate(options)}
${when(
x => x.role === MenuItemRole.menuitemradio,
html<FASTMenuItem>`
<div part="input-container" class="input-container">
<span part="radio" class="radio">
<slot name="radio-indicator">
${staticallyCompose(options.radioIndicator)}
x => x.hasSubmenu,
html<T>`
<div
part="expand-collapse-glyph-container"
class="expand-collapse-glyph-container"
>
<span part="expand-collapse" class="expand-collapse">
<slot name="expand-collapse-indicator">
${staticallyCompose(options.expandCollapseGlyph)}
</slot>
</span>
</div>
`
)}
</div>
${startSlotTemplate(options)}
<span class="content" part="content">
<slot></slot>
</span>
${endSlotTemplate(options)}
${when(
x => x.hasSubmenu,
html<T>`
<div
part="expand-collapse-glyph-container"
class="expand-collapse-glyph-container"
>
<span part="expand-collapse" class="expand-collapse">
<slot name="expand-collapse-indicator">
${staticallyCompose(options.expandCollapseGlyph)}
</slot>
</span>
</div>
`
)}
<span
?hidden="${x => !x.expanded}"
class="submenu-container"
part="submenu-container"
${ref("submenuContainer")}
>
<slot name="submenu" ${slotted({
property: "slottedSubmenu",
filter: elements("[role='menu']"),
})}></slot>
</span>
</template>
<span
?hidden="${x => !x.expanded}"
class="submenu-container"
part="submenu-container"
${ref("submenuContainer")}
>
<slot
name="submenu"
${slotted({
property: "slottedSubmenu",
filter: elements("[role='menu']"),
})}
></slot>
</span>
</template>
`;
}