Skip to content

Commit

Permalink
fixup! fix(menubar): add separator between radio groups
Browse files Browse the repository at this point in the history
  • Loading branch information
ShGKme committed Jan 31, 2024
1 parent 9be897e commit 0556f01
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Menu/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,12 @@ export default {
const children = entry.children ?? [entry]
// If this block has menu entries, it should be separated for better visibility and a11y (menu item radio grouping)
if (children.length > 1) {
const separatorBefore = acc.length ? [{ key: `separator-before-${entry.id}`, isSeparator: true }] : []
const separatorAfter = index !== remainingEntries.length - 1 ? [{ key: `separator-after-${entry.id}`, isSeparator: true }] : []
const hasPreviousItem = acc.length && !acc.at(-1).isSeparator
const separatorBefore = hasPreviousItem ? [{ key: `separator-before-${entry.id}`, isSeparator: true }] : []

const hasNextItem = index !== remainingEntries.length - 1
const separatorAfter = hasNextItem ? [{ key: `separator-after-${entry.id}`, isSeparator: true }] : []

return [...acc, ...separatorBefore, ...children, ...separatorAfter]
}
return [...acc, ...children]
Expand Down

0 comments on commit 0556f01

Please sign in to comment.