mapbox / dr-ui

Design system for docs.mapbox.com
https://mapbox.github.io/dr-ui/
BSD 2-Clause "Simplified" License
30 stars 11 forks source link

Reorganizing the contents of TopBarSticker #260

Closed katydecorah closed 3 years ago

katydecorah commented 4 years ago

I've been thinking about how we can better organize the contents of TopBarSticker, this ticket contains some ideas.

Also relevant: #259

Current problems

Ideas to solve: the wrapping navigation

On smaller screens, the tabbed navigation in TopBarSticker wraps: image

I've been seeing horizontal scrolling on too long navigation across several sites, more recently on: https://developer.twitter.com/en/docs/labs/hide-replies/api-reference/put-hidden

image

Stage Image
Current image
Proposed (draft) image

I'm not sure that I love this solution:

I would like to continue to research this and other patterns.

Ideas to solve: search takes up a lot of space

I wonder if the search button should live in the docs-page-shell.

Stage Image
Current image
Proposed (draft) image

A few notes:

katydecorah commented 4 years ago

I spent a few minutes this morning exploring what it would look like to add search feature to docs-page-shell. I think this is pretty interesting and will require discussion with the team:

The docs-page-shell using JavaScript (not React) so we wouldn't be able to plugin the dr-ui Search component. But this mean that we could use Swiftype's out-of-the-box JavaScript implementation.

Pros to using Swiftype's out-of-the-box feature

image Draft mock-up of what Swiftype's input could look like in the docs-page-shell (I'd spend more time making it look more Mapbox.)

image Swiftype's result view modal with paginated results and highlighted description based on search query. We would add CSS to make these results and in the input blend with the docs brand better.

Cons to using Swiftype's out-of-the-box feature

image Our current search results implementation

Testing

I pushed a demo of using Swiftype's out-of-the-box search to the /geographic-analytics staging site, but please note that I didn't do much to customize the styles yet, especially around responsive design yet.

Impressions

I'm surprised to say this, but I think I like Swiftype's out-of-the-box solution. Having spent a significant amount of time developing the dr-ui Search component, it would be nice to not have to continue to maintain it.

colleenmcginnis commented 4 years ago

I'm surprised to say this, but I think I like Swiftype's out-of-the-box solution.

I also like it! It's clean and I especially like the pagination.

katydecorah commented 4 years ago

Adding a note that @colleenmcginnis made a really great proposal in https://github.com/mapbox/documentation/issues/413 to use a dropdown for the main navigation items:

image

katydecorah commented 4 years ago

Building on some of these ideas:

Given the dropdown, we could keep the search on TopBarSticker and remove the button and modal to always show the input:

image

katydecorah commented 4 years ago

We'll also want to consider NavigationDropdown which is used as the mobile view for NavigationAccordion:

Image Image
image image

NavigationDropdown is a styled select which makes interacting with it a lot easier on mobile devices. Some page would see two dropdown menus on mobile if we move forward with making the TopBarSticker navigation a dropdown.

Things to consider:

katydecorah commented 4 years ago

Regarding the clashing of the navs (NavAccordion + TopBarSticker). For smaller screens, we could consolidate the navigation.

Larger screens

image

Smaller screens

Image Image
image image
katydecorah commented 4 years ago

Doing some research and it appears that using select element as navigation is not an ideal pattern in terms of accessibility. The select element it's meant for input (interacting for forms) and so it changes the scope of the element.

Ref: https://inclusive-components.design/menus-menu-buttons/

There some helpful patterns in the link above that I think we should explore, including this React component: https://github.com/HugoGiraudel/react-menu-button

katydecorah commented 4 years ago

Sharing some beautiful fly-out menu design inspo: https://dribbble.com/shots/11052651-Fly-out-menus/attachments/2648852?mode=media