Skip to content

Commit

Permalink
Fix nav hide bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kyledurand committed Jan 8, 2020
1 parent 48c28a7 commit 97bb2fa
Show file tree
Hide file tree
Showing 3 changed files with 210 additions and 157 deletions.
1 change: 1 addition & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### Bug fixes

- Fixed a bug where `Navigation` calls `onNavigationDismiss` on large screens when focused and the escape key is pressed ([#2607](https://github.com/Shopify/polaris-react/pull/2607))
- Fixed issue with `Filters` component displaying an undesired margin top and bottom on the button element on Safari ([#2292](https://github.com/Shopify/polaris-react/pull/2292))
- Doesn't render `MenuActions` if no actions are passed to an `actionGroups` item inside `Page` ([#2266](https://github.com/Shopify/polaris-react/pull/2266))
- Fixed `PositionedOverlay` incorrectly calculating `Topbar.UserMenu` `Popover` width ([#1692](https://github.com/Shopify/polaris-react/pull/1692))
Expand Down
9 changes: 8 additions & 1 deletion src/components/Frame/Frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,15 @@ class Frame extends React.PureComponent<CombinedProps, State> {

private handleNavKeydown = (event: React.KeyboardEvent<HTMLElement>) => {
const {key} = event;
const {
polaris: {
mediaQuery: {isNavigationCollapsed},
},
showMobileNavigation,
} = this.props;

if (key === 'Escape') {
const mobileNavShowing = isNavigationCollapsed && showMobileNavigation;
if (mobileNavShowing && key === 'Escape') {
this.handleNavigationDismiss();
}
};
Expand Down
Loading

0 comments on commit 97bb2fa

Please sign in to comment.