Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/navigation/NavBar.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.navbar-item-active {
border-bottom: 5px solid rgba(201, 210, 215, .4);
border-bottom: 5px solid rgba(201, 210, 215, 0.4);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@SuchitraSwain nit: in the future please try to avoid unrelated changes like this, they make reviews harder

}

.navbar-item-label {
Expand All @@ -26,7 +26,7 @@
width: 9.25rem;
}
.navbar-item-active {
border-left: 5px solid rgba(201, 210, 215, .4);
border-left: 5px solid rgba(201, 210, 215, 0.4);
border-bottom: 0;
}
}
Expand All @@ -50,3 +50,11 @@
display: none;
}
}

.navbar-item:focus {
outline: none;
}

.navbar-item:focus:not(:focus-visible) {
background-color: transparent;
}
4 changes: 2 additions & 2 deletions src/navigation/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const NavLink = ({
const href = `#${to}`
const active = alternative
? hash === href || hash.startsWith(`${href}${alternative}`)
: hash && hash.startsWith(href)
: hash === href || hash.startsWith(`${href}/`)
const anchorClass = classnames({
'bg-white-10 navbar-item-active': active,
'o-50 no-pointer-events': disabled
Expand All @@ -46,7 +46,7 @@ const NavLink = ({

return (
// eslint-disable-next-line jsx-a11y/anchor-is-valid
<a href={disabled ? undefined : href} className={anchorClass} role='menuitem' title={children}>
<a href={disabled ? undefined : href} onClick={(e) => e.currentTarget.blur()} className={anchorClass} role='menuitem' title={children}>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: in the future explain why things like this are added

for example:

Why this was added:

The navbar highlighting bug fix ensures the correct nav item is highlighted based on the URL. However, after clicking a nav item, it would retain the focus outline (often a blue
ring), creating a "double highlight" effect:

  • The active route highlight (from the CSS class)
  • The focus outline (from browser focus state)

By blurring on click, only the route-based highlighting remains visible.

<div className='db ph2 pv1'>
<div className='db'>
<Svg width='46' role='presentation' className={svgClass} />
Expand Down