From ca4710eb9b74b132194301b96c3a7e4e1dae356d Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Sun, 7 Jul 2019 19:20:04 +0100 Subject: [PATCH] Use innerWidth in js media-query-alike test --- app/src/frontend/search-box.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/frontend/search-box.js b/app/src/frontend/search-box.js index c7ffc280..c1298d6f 100644 --- a/app/src/frontend/search-box.js +++ b/app/src/frontend/search-box.js @@ -103,7 +103,7 @@ class SearchBox extends Component { componentDidMount() { window.addEventListener('resize', this.onResize); - if (window && window.outerHeight) { + if (window && window.innerHeight) { // if we're in the browser, pass in as though from event to initialise this.onResize({target: window}); } @@ -116,7 +116,7 @@ class SearchBox extends Component { // On a real mobile device onResize() gets called when the virtual keyboard pops up (e.g. when entering search text) // so be careful what states are changed in this method (i.e. don't collapse the search box here) onResize(e) { - this.setState({smallScreen: (e.target.outerWidth < 768)}); + this.setState({smallScreen: (e.target.innerWidth < 768)}); } render() {