]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16683 [891475] global menu aria-current
authorJeremy Davis <jeremy.davis@sonarsource.com>
Thu, 28 Jul 2022 09:55:56 +0000 (11:55 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 29 Jul 2022 20:03:14 +0000 (20:03 +0000)
server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx

index 866004c5051fb7f5acf2f232ab9de3a4eb90e020..ae72bfedf00b432da7eebc73726fa5f78ca78d7e 100644 (file)
@@ -46,7 +46,10 @@ export class GlobalNavMenu extends React.PureComponent<Props> {
 
     return (
       <li>
-        <Link className={classNames({ active })} to="/projects">
+        <Link
+          aria-current={active ? 'page' : undefined}
+          className={classNames({ active })}
+          to="/projects">
           {translate('projects.page')}
         </Link>
       </li>
@@ -64,17 +67,18 @@ export class GlobalNavMenu extends React.PureComponent<Props> {
   }
 
   renderIssuesLink() {
-    const active = this.props.location.pathname.startsWith('/issues');
-
     const search = (this.props.currentUser.isLoggedIn && isMySet()
       ? new URLSearchParams({ resolved: 'false', myIssues: 'true' })
       : new URLSearchParams({ resolved: 'false' })
     ).toString();
+
     return (
       <li>
-        <Link className={classNames({ active })} to={{ pathname: '/issues', search }}>
+        <NavLink
+          className={({ isActive }) => (isActive ? ACTIVE_CLASS_NAME : '')}
+          to={{ pathname: '/issues', search }}>
           {translate('issues.page')}
-        </Link>
+        </NavLink>
       </li>
     );
   }