Closed katydecorah closed 3 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.
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.)
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.
Our current search results implementation
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.
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.
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.
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:
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:
We'll also want to consider NavigationDropdown which is used as the mobile view for NavigationAccordion:
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:
Regarding the clashing of the navs (NavAccordion + TopBarSticker). For smaller screens, we could consolidate the navigation.
Image | Image |
---|---|
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
Sharing some beautiful fly-out menu design inspo: https://dribbble.com/shots/11052651-Fly-out-menus/attachments/2648852?mode=media
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:
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
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.
A few notes: