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

feature/deseng661: Implemented new admin navigation design. #2565

Merged
merged 8 commits into from
Jul 25, 2024

Conversation

jareth-whitney
Copy link
Contributor

Issue #: 🎟️ DESENG-661

  • Implemented new admin navigation menu
  • This includes mobile and desktop viewports
  • This does not include dark mode
  • User and tenant sections will be handled in header ticket (as per Steve)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the met-public license (Apache 2.0).

@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 87.80488% with 5 lines in your changes missing coverage. Please review.

Project coverage is 76.01%. Comparing base (bcbdcdc) to head (9fde5cc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2565      +/-   ##
==========================================
+ Coverage   75.99%   76.01%   +0.01%     
==========================================
  Files         609      609              
  Lines       21924    21940      +16     
  Branches     1747     1752       +5     
==========================================
+ Hits        16662    16678      +16     
- Misses       4998     4999       +1     
+ Partials      264      263       -1     
Flag Coverage Δ
metweb 64.80% <87.80%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
.../src/components/layout/SideNav/SideNavElements.tsx 100.00% <100.00%> (ø)
...web/src/components/layout/SideNav/UserGuideNav.tsx 50.00% <66.66%> (+4.83%) ⬆️
met-web/src/components/layout/SideNav/SideNav.tsx 93.33% <91.17%> (+2.42%) ⬆️

// If the route name doesn't match an expected page title, return the broken link icon
const possiblePageTitles: string[] = Object.keys(iconAssignments).filter((key) => key.includes(route.name));
if (0 === possiblePageTitles.length) {
return <FontAwesomeIcon icon={faLinkSlash} style={fontAwesomeStyles} />;
Copy link
Contributor

Choose a reason for hiding this comment

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

nice touch with the broken link icon :)

setOpen: (open: boolean) => void;
}

export interface IconAssignments {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a lot of trouble to go to... I'm thinking you should just extend the interface Route to include an icon?: IconDefinition which you can then render in your list mapping (or the broken link otherwise). Let me know if there'd be an issue with that

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, aren't these other strings redundant if you have [k: string]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this based on your second comment, I didn't realize that I could just define the structure and not the keys.

return <FontAwesomeIcon icon={iconAssignments[route.name]} style={fontAwesomeStyles} />;
};

const CloseButton = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sonarcloud is suggesting (and I tend to agree) that this component definition should be extracted from the DrawerBox component and have its onClick behaviour passed in. Otherwise, just create it inline and use <When>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem, I changed this so that the component is not within the DrawerBox.

</List>
</Box>
);
};

const SideNav = ({ open, setOpen, isMediumScreen, drawerWidth = 280 }: SideNavProps) => {
const SideNav = ({ open, setOpen, isMediumScreen, drawerWidth = 300 }: SideNavProps) => {
if (!drawerWidth) return <></>;
return (
<ThemeProvider theme={DarkTheme}>
Copy link
Contributor

Choose a reason for hiding this comment

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

The DarkTheme provider around this component no longer really makes sense and should be removed, since the menu has gone from a dark background to a light one. This will probably save you some unnecessary style overrides deeper in the component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I removed it.

@NatSquared NatSquared self-requested a review July 25, 2024 00:38
Copy link
Contributor

@NatSquared NatSquared left a comment

Choose a reason for hiding this comment

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

Thank you for addressing my comments! If you could merge #2566 into this before it goes to main I'd appreciate it <3

// Otherwise return the icon for the icon assignments key name that matches the route name.
return <FontAwesomeIcon icon={iconAssignments[route.name]} style={fontAwesomeStyles} />;
};

return (
<Box
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice making this menu a list in HTML! Since this is a page region, assistive technologies can benefit from having it marked as such. The below code will make the outer element a <nav> and give it a label.

https://www.w3.org/WAI/tutorials/page-structure/regions/#navigation

Suggested change
<Box
<Box
component="nav"
aria-labelledby="Editor navigation"

Copy link
Contributor

Choose a reason for hiding this comment

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

Aria-labelledby is for passing in an element ID; you want aria-label instead

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks @NatSquared that's my bad. Also I think the label itself could probably be improved to something like "Admin navigation menu"

* Patch for DESENG-661: Optimizations and Accessibility

* Unify route item styles

* Sonarcloud issues? Fixed
width: '1.1rem',
}}
/>
<MetHeader4
Copy link
Collaborator

@Baelx Baelx Jul 25, 2024

Choose a reason for hiding this comment

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

Folks using assistive technologies will expect headers to denote a section to follow. If you just used an <h4> to make the text large and prominent, then you should use a link tag and style it to be large and prominent instead.

Also I'd strongly recommend we update the openHelpPage function to open the link in the same window. Using new windows/tabs can confuse some users and are discouraged unless preserving the current context of the page is absolutely necessary: https://www.w3.org/WAI/WCAG21/Techniques/general/G200

Copy link
Collaborator

@Baelx Baelx left a comment

Choose a reason for hiding this comment

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

I'm just seeing a few places where we can improve the accessibility experience. Can we discuss before you proceed?

  • Make the parent HTML tag of the menu a nav and label it
  • Change the Buttons in the menu to Links
  • Don't use Heading tags in the nav menu unless they describe a section to follow. For large, prominent text, just use styling

Copy link

sonarcloud bot commented Jul 25, 2024

@jareth-whitney jareth-whitney merged commit 3443e95 into main Jul 25, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants