Skip to content

Commit

Permalink
prevent mobile keyboard from popping up by default
Browse files Browse the repository at this point in the history
  • Loading branch information
zr0w1 committed Dec 7, 2024
1 parent 8ebafaf commit f821741
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions assets/chat/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,17 @@ class Chat {
e.preventDefault();
e.stopPropagation();
this.control.emit('SEND', this.input.val().toString().trim());
this.input[0].inputMode = 'none';
this.adjustInputHeight();
this.input.focus();
}
});

this.input.on('click', () => {
this.input[0].inputMode = 'text';
this.adjustInputHeight();
});

// Watching focus
this.ui.on('click touch', '#chat-watching-focus-btn', () => {
this.watchingfocus = !this.watchingfocus;
Expand All @@ -428,6 +434,7 @@ class Chat {
downinoutput = false;
ChatMenu.closeMenus(this);
this.focusIfNothingSelected();
this.input[0].inputMode = 'none';
}
});
this.ui.on('click', '#chat-tools-wrap', () => {
Expand Down
10 changes: 10 additions & 0 deletions assets/chat/js/menus/ChatEmoteMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export default class ChatEmoteMenu extends ChatMenu {
{ atBegin: false },
),
);
this.searchinput.on('click', () => {
this.searchinput[0].inputMode = 'text';
});
}

show() {
Expand All @@ -34,6 +37,13 @@ export default class ChatEmoteMenu extends ChatMenu {
this.buildEmoteMenu();
}

hide() {
if (this.visible) {
this.searchinput[0].inputMode = 'none';
}
super.hide();
}

buildEmoteMenu() {
const favoriteEmotes = [...this.chat.favoriteemotes].filter((e) =>
this.chat.emoteService.hasEmote(e),
Expand Down
10 changes: 10 additions & 0 deletions assets/chat/js/menus/ChatUserMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,23 @@ export default class ChatUserMenu extends ChatMenu {
{ atBegin: false },
),
);
this.searchinput.on('click', () => {
this.searchinput[0].inputMode = 'text';
});
}

show() {
super.show();
this.searchinput.focus();
}

hide() {
if (this.visible) {
this.searchinput[0].inputMode = 'none';
}
super.hide();
}

redraw() {
if (this.visible) {
const searching = this.searchterm.length > 0;
Expand Down
3 changes: 3 additions & 0 deletions assets/views/embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
tabindex="1"
autofocus
spellcheck
inputmode="none"
></textarea>
<a id="chat-input-subonly" class="chat-tool-btn" title="Subonly mode">
<i class="btn-icon"></i>
Expand Down Expand Up @@ -274,6 +275,7 @@ <h5><span>Users</span> <i class="chat-menu-close"></i></h5>
class="form-control"
value=""
placeholder="Username search ..."
inputmode="none"
/>
</div>
</div>
Expand Down Expand Up @@ -391,6 +393,7 @@ <h5><span>Emotes</span> <i class="chat-menu-close"></i></h5>
class="form-control"
value=""
placeholder="Emote search ..."
inputmode="none"
/>
</div>
</div>
Expand Down

0 comments on commit f821741

Please sign in to comment.