Skip to content

Commit 122088b

Browse files
committed
This fixes the sidebar on mobile view, as it stops hiding the sidebar on every size change, as the displaying of the keyboard, changes the viewable size, but should not collapse the sidebar again, as otherwise a search is impossible
Signed-off-by: Kai Wagner <kai.wagner@percona.com>
1 parent f297fca commit 122088b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

app/javascript/controllers/sidebar_controller.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default class extends Controller {
1515
this.handleDocumentClick = this.handleDocumentClick.bind(this)
1616
window.addEventListener("resize", this.handleWindowResize)
1717
document.addEventListener("click", this.handleDocumentClick)
18+
this.wasMobile = this.isMobile()
1819

1920
if (!this.hasLayoutTarget || !this.hasSidebarTarget) {
2021
return
@@ -86,8 +87,12 @@ export default class extends Controller {
8687
}
8788

8889
handleWindowResize() {
89-
if (this.isMobile()) {
90+
const isMobile = this.isMobile()
91+
if (this.wasMobile && !isMobile) {
9092
this.closeMobile()
93+
}
94+
this.wasMobile = isMobile
95+
if (isMobile) {
9196
return
9297
}
9398

0 commit comments

Comments
 (0)