Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile improvements #587

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions assets/chat/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ hr {
fill: a.$color-surface-dark4;
}

/* Mobile viewports only */
@media only screen and (max-width: 450px) {
input,
textarea {
font-size: 16px;
}
}

/* Small screen, non-retina */
@media only screen and (min-width: 320px) {
body:not(.pref-fontscale) {
Expand Down
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