Skip to content

Commit

Permalink
More improvements to accessibility of user menu
Browse files Browse the repository at this point in the history
- Replace hover animation with font-weight change
- Remove pointer-event rule that caused menu to be non-interactive in
  some scenarios
- Use action for login, rather than route
  • Loading branch information
dmfalke committed Nov 18, 2024
1 parent fc9beda commit 97d1f21
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
9 changes: 3 additions & 6 deletions packages/libs/web-common/src/App/UserMenu/UserMenu.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';
import { Link } from 'react-router-dom';

import './UserMenu.scss';

import { IconAlt as Icon } from '@veupathdb/wdk-client/lib/Components';
import { showLogoutWarning } from '@veupathdb/wdk-client/lib/Actions/UserSessionActions';

import './UserMenu.scss';

class UserMenu extends React.Component {
constructor(props) {
Expand All @@ -19,9 +18,7 @@ class UserMenu extends React.Component {
{
icon: 'sign-in',
text: 'Login',
route: `/user/login?destination=${encodeURIComponent(
window.location
)}`,
onClick: () => actions.showLoginForm(window.location),
},
{
icon: 'user-plus',
Expand Down
8 changes: 3 additions & 5 deletions packages/libs/web-common/src/App/UserMenu/UserMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ $white: #e0e0e0;
&:hover {
.UserMenu-Pane {
opacity: 1;
pointer-events: all;
transition: none;
}
}
}

.UserMenu-Pane {
transition: opacity 1s 500ms;
transition: opacity 500ms 1s;
opacity: 0;
pointer-events: none;

right: 0;
top: 100%;
Expand Down Expand Up @@ -78,15 +76,15 @@ $white: #e0e0e0;
text-decoration: none;
}
flex: 1;
border-radius: 0.2em;
display: flex;
font-size: 1.3em;
padding: 5px;
flex-direction: row;
white-space: nowrap;
cursor: pointer;
transition: all 0.4s;
&:hover {
transform: scale(1.04);
font-weight: 500;
}
.UserMenu-Pane-Item-Icon {
width: 20px;
Expand Down

0 comments on commit 97d1f21

Please sign in to comment.