diff --git a/webroot/js/app.js b/webroot/js/app.js
index d39886f5d..2a5441468 100644
--- a/webroot/js/app.js
+++ b/webroot/js/app.js
@@ -50,6 +50,7 @@ export default class App extends Component {
displayChat: chatStorage === null ? true : chatStorage,
chatInputEnabled: false, // chat input box state
username: getLocalStorage(KEY_USERNAME) || generateUsername(),
+ touchKeyboardActive: false,
configData: {},
extraPageContent: '',
@@ -78,6 +79,8 @@ export default class App extends Component {
// misc dom events
this.handleChatPanelToggle = this.handleChatPanelToggle.bind(this);
this.handleUsernameChange = this.handleUsernameChange.bind(this);
+ this.handleFormFocus = this.handleFormFocus.bind(this);
+ this.handleFormBlur = this.handleFormBlur.bind(this);
this.handleWindowResize = debounce(this.handleWindowResize.bind(this), 250);
this.handleOfflineMode = this.handleOfflineMode.bind(this);
@@ -284,6 +287,22 @@ export default class App extends Component {
});
}
+ handleFormFocus() {
+ if (this.hasTouchScreen) {
+ this.setState({
+ touchKeyboardActive: true,
+ });
+ }
+ }
+
+ handleFormBlur() {
+ if (this.hasTouchScreen) {
+ this.setState({
+ touchKeyboardActive: false,
+ });
+ }
+ }
+
handleChatPanelToggle() {
const { displayChat: curDisplayed } = this.state;
@@ -326,6 +345,7 @@ export default class App extends Component {
playerActive,
streamOnline,
streamStatusMessage,
+ touchKeyboardActive,
username,
viewerCount,
websocket,
@@ -373,6 +393,7 @@ export default class App extends Component {
'bg-gray-800': singleColMode && displayChat,
'short-wide': shortHeight && windowWidth > WIDTH_SINGLE_COL,
'touch-screen': this.hasTouchScreen,
+ 'touch-keyboard-active': touchKeyboardActive,
});
const poster = isPlaying ? null : html`
@@ -407,7 +428,9 @@ export default class App extends Component {
>
<${UsernameForm}
username=${username}
- handleUsernameChange=${this.handleUsernameChange}
+ onUsernameChange=${this.handleUsernameChange}
+ onFocus=${this.handleFormFocus}
+ onBlur=${this.handleFormBlur}
/>
diff --git a/webroot/styles/app.css b/webroot/styles/app.css
index 1ea3fcc9e..8030c5c64 100644
--- a/webroot/styles/app.css
+++ b/webroot/styles/app.css
@@ -202,10 +202,10 @@ header {
}
@media screen and (max-height: 500px) {
- .single-col.touch-screen {
+ .single-col.touch-screen:not(.touch-keyboard-active) {
--header-height: 0px;
}
- .single-col.touch-screen header {
+ .single-col.touch-screen:not(.touch-keyboard-active) header {
display: none;
}
}