-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(menubar): add separator between radio groups
- Separates different parts visually - Required for a11y to group radio button in the menu Signed-off-by: Grigorii K. Shartsev <[email protected]>
- Loading branch information
Showing
3 changed files
with
30 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
- | ||
- @author Vinicius Reis <[email protected]> | ||
- @author Julius Härtl <[email protected]> | ||
- @author Grigorii K. Shartsev <[email protected]> | ||
- | ||
- @license AGPL-3.0-or-later | ||
- | ||
|
@@ -161,12 +162,19 @@ export default { | |
return list | ||
}, | ||
hiddenEntries() { | ||
const entries = this.entries.filter(({ priority }) => { | ||
const remainingEntries = this.entries.filter(({ priority }) => { | ||
// reverse logic from visibleEntries | ||
return priority !== undefined && priority > this.iconsLimit | ||
}).reduce((acc, entry) => { | ||
}) | ||
const entries = remainingEntries.reduce((acc, entry, index) => { | ||
// If entry has children, merge them into list. Otherwise keep entry itself. | ||
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 }] : [] | ||
return [...acc, ...separatorBefore, ...children, ...separatorAfter] | ||
} | ||
return [...acc, ...children] | ||
}, []) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
* @copyright Copyright (c) 2019 Julius Härtl <[email protected]> | ||
* | ||
* @author Julius Härtl <[email protected]> | ||
* @author Grigorii K. Shartsev <[email protected]> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
|
@@ -194,6 +195,13 @@ export default [ | |
return command.toggleHeading({ level: 6 }) | ||
}, | ||
}, | ||
{ | ||
key: 'headings-separator', | ||
isSeparator: true, | ||
visible: ({ $outlineState }) => { | ||
return $outlineState.enable | ||
}, | ||
}, | ||
{ | ||
key: 'outline', | ||
icon: FormatListBulleted, | ||
|