-
Notifications
You must be signed in to change notification settings - Fork 34
feat(#2478): add work side menu component #2937
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
base: alpha
Are you sure you want to change the base?
Conversation
cd20c58
to
42fa52c
Compare
4779b0d
to
92ef9ee
Compare
92ef9ee
to
a621a80
Compare
a621a80
to
7408642
Compare
@@ -0,0 +1,34 @@ | |||
import { GoabWorkSideMenuItemType, GoabWorkSideMenuItemVariation } from "@abgov/ui-components-common"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just adding all of these at the top of this file, this is not indicative of where the issue is located.
- Missing exports for Angular in "index.tsx"
- GoabWorkSideMenuItem is exported as GoabAWorkSideMenuItem in React
- URL is listed as required for WorkSideMenuItem for React
- URL is listed as required for WorkSideMenu for React
- Popover for User account is not positioned inside container - maybe not an issue, discuss with @twjeffery, it appears in the container if the side menu is pinned to the left of the window.
- If Side Menu is pinned to the left, Popover opens up directly over top of the link, not above or below - maybe not an issue, discuss with @twjeffery
- Tooltips in condensed menu are not positioned inside the container - maybe not an issue, discuss with @twjeffery , it appears in the container if the side menu is pinned to the left
- Doesn't seem to be a way to activate side-menu-items that don't have a URL, but have submenus inside of them, I would expect it to expand to show the submenus
- No way to provide a click event for Sub Menu Items that don't have a URL
- Don't know how to re-open SideMenu on a mobile device - discuss with @chrisolsen if our current solution of providing an event to trigger, rather than a variable is what we want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ArakTaiRoth I've amended my commit with updates to the React and Angular wrappers. I've tested both wrappers and they appear to work as expected for me.
Here's how the sub nav works for me:
I'm leaving the onClick events and alignment issues for now. I'll wait for @chrisolsen's feedback on the overall component before I work on those details as some may not be relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdfranck When you referenced "alignment issues" are you referring to the slight shifting of things when expanding and collapsing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The known issue is that the overlays assume the menu is in the top left of the viewport without any margins or padding. This is true with all the Figma mockups so far.
The tooltip and menu overlays use fixed positioning, so they look fine when the menu is in the top left...
But they are misaligned when the menu is not:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ArakTaiRoth I realized that the issue with the menu item submenu and click event were because I changed the url
to optional. I only did it so I could reuse the menu item for a toggle button.
I can't think of any good scenario why a team would want to have a nav item without a url
. It only introduces issues. So I made the following changes and amended my commit:
- Made the
url
property required on thework-side-menu-item
and the wrappers - Changed the menu toggle item from a
work-side-menu-item
to a button
This should address the issues that you previously mentioned.
5fd66cf
to
bd2296c
Compare
libs/web-components/src/components/work-side-menu/WorkSideMenu.svelte
Outdated
Show resolved
Hide resolved
libs/web-components/src/components/work-side-menu/WorkSideMenu.svelte
Outdated
Show resolved
Hide resolved
libs/web-components/src/components/work-side-menu/WorkSideMenu.svelte
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,34 @@ | |||
import { GoabWorkSideMenuItemType, GoabWorkSideMenuItemVariation } from "@abgov/ui-components-common"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdfranck When you referenced "alignment issues" are you referring to the slight shifting of things when expanding and collapsing?
libs/react-components/src/experimental/work-side-menu-item/work-side-menu-item.spec.tsx
Show resolved
Hide resolved
libs/web-components/src/components/work-side-menu/WorkSideMenu.svelte
Outdated
Show resolved
Hide resolved
libs/web-components/src/components/work-side-menu/WorkSideMenuItem.spec.ts
Show resolved
Hide resolved
libs/web-components/src/components/work-side-menu/WorkSideMenuItem.svelte
Outdated
Show resolved
Hide resolved
dcaafd1
to
2f8be46
Compare
libs/react-components/src/experimental/work-side-menu-item/work-side-menu-item.tsx
Show resolved
Hide resolved
a9ee85d
to
fce252b
Compare
@chrisolsen I addressed all your comments and pushed an amended commit. I've also added browser tests for testing events in the menu and menu item. Does the location of the Angular |
1 similar comment
@chrisolsen I addressed all your comments and pushed an amended commit. I've also added browser tests for testing events in the menu and menu item. Does the location of the Angular |
fce252b
to
d3a339f
Compare
I also noticed some formatting issues. I fixed them and pushed an amended commit. |
1. Back button 2. Submenu items 3. Menu state persistence 4. Keyboard navigation for the account menu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @bdfranck, I pulled in the changes and noticed a few more small things, added as comments
libs/web-components/src/components/work-side-menu/WorkSideMenu.svelte
Outdated
Show resolved
Hide resolved
libs/web-components/src/components/work-side-menu/WorkSideMenu.svelte
Outdated
Show resolved
Hide resolved
libs/web-components/src/components/work-side-menu/WorkSideMenu.svelte
Outdated
Show resolved
Hide resolved
d9bc5b7
to
3a8395a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdfranck Just one small potential update, looks good
3a8395a
to
15b581e
Compare
15b581e
to
1a1e834
Compare
libs/react-components/src/experimental/work-side-menu/work-side-menu.tsx
Outdated
Show resolved
Hide resolved
1a1e834
to
e75ad09
Compare
Thanks, @vanessatran-ddi! I've amended the commit and switched to using skewer case on those properties. |
@@ -0,0 +1,2 @@ | |||
export * from "./work-side-menu/work-side-menu"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I test with angular and have this error:
I tried with import { GoaxWorkSideMenu, GoaxWorkSideMenuItem } from "@abgov/angular-components";
and import { GoaxWorkSideMenu, GoaxWorkSideMenuItem } from "@abgov/angular-components/experimental"; but it doesn't work. I need to add my own code like below screenshot under
libs/angular-components/index.ts` in order to test
I think for React, it is working that way because we have libs/react-components/package.json
where we export the experimental
so React app can import from this path, however in angular we don't have it set up now. We need to setup more to allow users import from experimental
path.
@@ -0,0 +1,812 @@ | |||
<svelte:options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA result for accessibility:
workspace-sidemenu.mov
There are 2 problems:
- I press "Arrow Down" to move from Dashboard -> Project ->....-> Help & Suport -> John Doe (username), I need to press "Tab" if I want to focus on username. Expectation: I think we should be able to press Arrow Down to continue to focus on John Doe instead of Tab
- When I press Enter after I focus on Jonh Doe (username), I can see the Menu displayed where I can arrow up and down to select options "My Profile", "Preferences" and "Sign Out" which is great. However, if I continue to Arrow Down, it move to Collapse Menu or Arrow Up, it moves to Analytics, without closing the menu. Expectation: I think we should auto-close the menu under username if we don't focus on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdfranck This is my angular code:
<div style="height: 100vh; display: flex;">
<goax-work-side-menu
heading="My Application"
url="/"
userName="John Doe"
userSecondaryText="john.doe@gov.ab.ca"
testId="workspace-side-menu"
[primaryContent]="primaryMenu"
[secondaryContent]="secondaryMenu"
[accountContent]="accountMenu"
>
</goax-work-side-menu>
<div style="flex: 1; padding: 2rem; overflow-y: auto;">
<h1>Workspace Side Menu Demo</h1>
<p>This is a demonstration of the Workspace Side Menu component.</p>
</div>
</div>
<!-- Primary Menu Template -->
<ng-template #primaryMenu>
<goax-work-side-menu-item
url="#dashboard"
label="Dashboard"
icon="home"
/>
<goax-work-side-menu-item
url="#projects"
label="Projects"
icon="folder"
badge="3"
type="success"
/>
<goax-work-side-menu-item
url="#team"
label="Team"
icon="people"
/>
<goax-work-side-menu-item
url="#calendar"
label="Calendar"
icon="calendar"
badge="5"
type="emergency"
/>
<goax-work-side-menu-item
url="#documents"
label="Documents"
icon="document"
[divider]="true"
/>
<goax-work-side-menu-item
url="#analytics"
label="Analytics"
icon="stats-chart"
/>
</ng-template>
<!-- Secondary Menu Template -->
<ng-template #secondaryMenu>
<goax-work-side-menu-item
url="#settings"
label="Settings"
icon="settings"
/>
<goax-work-side-menu-item
url="#help"
label="Help & Support"
icon="help-circle"
/>
</ng-template>
<ng-template #accountMenu>
<goax-work-side-menu-item
url="#profile"
label="My Profile"
icon="person"
/>
<goax-work-side-menu-item
url="#preferences"
label="Preferences"
icon="cog"
/>
<goax-work-side-menu-item
url="#logout"
label="Sign Out"
icon="log-out"
/>
</ng-template>
@@ -0,0 +1,812 @@ | |||
<svelte:options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screen reader:
I checked the below reference: when we have a collapse menu, press the menu, and display options, I think we should have a way to tell users:
https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-navigation/
I think we can do that by aria-expanded..
Right now, this is what happening if I use the Voice Over:
voiceover-workspace-menu.mov
There are no difference between Button Group inside the User's Menu and button group inside the Workspace side menu. When I checked some resources on W3 https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/, expanded
or colapse
is a good hint here, some resources also mentioned: You are on the XX item, level 2 (for example)
@@ -0,0 +1,812 @@ | |||
<svelte:options | |||
customElement={{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accessibility tested on Windows - Edge 141 latest:
When I navigate by keyboard, I "Tab" to focus on username John Doe , I press "Enter" to open the Menu, I arrow up/down to focus on the menu item inside, The screen reader announces I am on "Log out", "Preferences"... but I cannot see the item yellow/highlight.
accessibility-windows-workspace-menu.mov
} | ||
} | ||
|
||
/* eslint-disable-next-line */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: do we need this comment to disable eslint? I don't see any obvious eslint error here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments about accessibility testing.
4e7c939
to
d2d06bd
Compare
d2d06bd
to
8615c83
Compare
This PR adds the work side menu component.
How to test
Use the
v2 experimental
design tokens branch for proper colours and border values:https://github.com/GovAlta/design-tokens/tree/v2-2998-coded-component-updates
Add this example menu to your playground: