Skip to content

Commit fac7134

Browse files
abdullahtariq1171SaraVieira
authored andcommitted
[Dashboard] Keep sidebar open when search input is focused (codesandbox#1937)
1 parent 3c0bf1a commit fac7134

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/app/src/app/pages/Dashboard/Sidebar/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { TEAMS_QUERY } from '../queries';
1818

1919
class Sidebar extends React.Component {
2020
handleSearchFocus = () => {
21-
history.push('/dashboard/search');
21+
history.push('/dashboard/search', { from: 'sandboxSearchFocused' });
2222
};
2323

2424
handleSearchChange = e => {

packages/app/src/app/pages/Dashboard/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ class Dashboard extends React.Component {
5252
} = this.props;
5353
const { showSidebar } = this.state;
5454

55-
history.listen(() => {
55+
history.listen(({ state }) => {
56+
if (!!state && state.from === 'sandboxSearchFocused') {
57+
return;
58+
}
59+
5660
this.onRouteChange();
5761
});
5862

0 commit comments

Comments
 (0)