Skip to content

fix: ensure side panel closes on outside click on mobile device #73

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
11 changes: 11 additions & 0 deletions public/css/docs/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,17 @@ h2 {
margin: 12px;
}

@media screen and (max-width: 640px) {
.side-menu-head .icon-button.side-menu-close-button {
border: none;
}
.side-menu-head .icon-button.side-menu-close-button .icon {
width: 24px;
height: 24px;
margin: 0px;
}
}

.side-menu-wrapper {
width: 0;
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/top-nav/side-menu/drawer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import namespaces from 'namespace-list';
import filter from 'filter-pkg-tree';
import deprefix from 'deprefix-pkg-name';
import log from 'log';
import viewportWidth from 'viewport-width';
import VersionMenu from './version_menu.jsx';
import Head from './head.jsx';
import Filter from './filter.jsx';
Expand Down Expand Up @@ -798,12 +799,14 @@ class SideMenuDrawer extends React.Component {
* @returns {ReactElement} React element
*/
render() {
const isMobile = viewportWidth() <= 640;
return (
<Drawer
className="side-menu-drawer"
variant="persistent"
variant={isMobile ? 'temporary' : 'persistent'}
anchor="left"
open={ this.props.open }
onClose={isMobile ? this._onMenuClose : undefined}
classes={{
paper: 'side-menu-drawer'
}}
Expand Down