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

Improve display of navbar dropdowns #676

Merged
merged 3 commits into from
Apr 11, 2024
Merged

Conversation

reefdog
Copy link
Contributor

@reefdog reefdog commented Apr 10, 2024

This PR improves the look of our navbar dropdowns in preparation for the user menu dropdown (#618).

Before:
dropdown-before

After:
dropdown-after

If you think that's a stylistic regression…

Maybe some of you will think "Ah, but, that's less attractive!" And you're not wrong, but, the new format looks better when interleaved with more traditional dropdown items (which we don't want to always force into the "small uppercase" format):

navbar.mov

Along for the ride come some text accessibility improvements and an improvement to the :focus outline when keyboard-navigating the menu.

Testing:

You can test this via the deploy preview, since the affected menus are available while logged-out. You can also hit the Storybook deployment to see the updated Dropdown stories. Just make sure dropdowns are legible and not a regression from earlier forms.

Resolves #667

This commit reduces our use of decorative small type, which can be
inaccessible to low-sight users. Except for very specific contexts (such
as inline code, which renders in monotype text, which appears larger
than surrounding sans-serif type anyway), we limit our “small text” to
only 5% smaller than root, e.g., `0.95rem`.

Some elements will now appear a little larger (navbar items, decorative
headers, badges, sidebar metadata). Some will look the same but now use
a global CSS variable.

No issue, but a prerequisite task for work on #667.
Prior to this commit, we had a bit of an ad hoc / HTML-native way of
adding descriptions to dropdown menu items, customized just for our two
current navbar dropdowns. This felt unidiomatic both for React and for
our Dropdown component ergonomics.

Now, we have a `DropdownMenuLinkDescription` component that you can
optionally add to a `DropdownMenuLink`, alongside the existing text,
which renders some smaller explanatory text below the title.

Along the way, we also:

- Change the styling of these navbar items with descriptions so that
  they match items without descriptions. (h/t @slifty)
- Make sure menu link icons stay aligned with the “title” of the link,
  not centered by the description — and don’t let them shrink
- Update stories to match (and with more representative examples)

Issue #667 Change formatting of navbar dropdowns
Copy link

netlify bot commented Apr 10, 2024

Deploy Preview for philanthropy-data-commons-viewer ready!

Name Link
🔨 Latest commit 13d555c
🔍 Latest deploy log https://app.netlify.com/sites/philanthropy-data-commons-viewer/deploys/66170708d25f9c00083cc128
😎 Deploy Preview https://deploy-preview-676--philanthropy-data-commons-viewer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

In browsers/OSes that support keyboard-tabbing through link controls,
our dropdown menus can be tabbed-through. Prior to this commit, however,
the focus outlines were clipped.

No longer! Now they are visible, and even curved at top and bottom to
match the menu itself.
@@ -67,8 +67,15 @@
border-bottom: 1px solid var(--color--gray--light);
}

.dropdown-menu > *:first-child {
border-top-left-radius: var(--dropdown--menu--border-radius);
Copy link
Contributor

Choose a reason for hiding this comment

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

I did not know that this was a thing you could set with css, very cool!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean CSS variables, or setting the border radius?

Copy link
Contributor

@hminsky2002 hminsky2002 left a comment

Choose a reason for hiding this comment

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

This looks idiomatically appropriate, and style wise looks great. Approved from me!

@reefdog reefdog merged commit 27b336b into main Apr 11, 2024
10 checks passed
@reefdog reefdog deleted the 667-change-navbar-dropdowns branch April 11, 2024 01:18
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.

Change formatting of navbar dropdowns
2 participants