-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Automatically focus "send message" when the user is typing #1416
Conversation
It looks like something weird happened with your commit - it includes all the changes I made in this commit: 46b64e3 I see that I'm also (strangely) one of the authors on your change. Did you perhaps amend my original commit? I'm testing the change now, but we won't be able to get this approved and merged until the changes are cleaned up. Please author a new commit with just your changes in |
Okay, I just played with it a bit, and it works pretty well. However, it does fail in a couple scenarios:
Maybe the right solution is to limit the click-handling to outside the message bubbles? |
0196f0e
to
04aad58
Compare
I just noticed that, dunno what went wrong, anyway I rebased with
OK, give me a bit more time 💃 |
I actually miss this feature in Signal Desktop but it would probably be more useful focusing the input field as one starts typing as it happens in WhatsApp Web. What do you think? |
@cyrus-and definitely yes! I thought the same right after opening this PR and writing to a friend on WhatsApp 👯♀️ I need to be extra careful though, adding a global event listener might be quite invasive. I'll try to push some code soon and have an early feedback to validate my approach. |
c7cc06f
to
866a77a
Compare
@scottnonnenberg: I changed the approach, I'm using keyboard events now (the behavior is similar to WhatsApp Web). I've put the event listener in @cyrus-and: ✨ check it out ✨ |
866a77a
to
781840c
Compare
js/chromium.js
Outdated
var lightbox = document.querySelector('.lightbox'); | ||
var element = document.querySelector('textarea.send-message'); | ||
|
||
if (tagName == 'INPUT' || tagName == 'TEXTAREA' || lightbox) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use triple equals here.
@vrde awesome, works great so far! |
@vrde you may want to restrict this to the typeable events? For example, tab doesn't work as intended anymore. |
|
I changed the event listener from |
@vrde There is another thing I noticed, the patch should detect whether the conversation is active or not, for example when the settings pane is open or when a user clicks the top left "Signal" title. That is: if (document.querySelector('.conversation-stack.inactive')) {
return;
} It would be nice to bind/unbind the |
Good point. I've changed the lightbox selector to a more generic modal selector, what do you think? (I can squash the commits once you are satisfied with the PR) |
@vrde it doesn't seem to work with menus and inactive conversations. Checking the conversation status (via |
@vrde Oh bummer, the conversation is still active if the user interacts with the conversation menu... :( This is a possible (ugly) check: document.querySelectorAll('.menu-list[style="display: block;"]').length Just to make it clear, I'm not a member of this repo don't feel compelled to address every comment I make, I'm just trying to help :) |
97096f0
to
6de90c0
Compare
@cyrus-and: I was trying the same and yep, the selector is savage 🐯. IMO it's fine if a keypress goes through when a drop down menu is open (also, you cannot control those drop down menus using the keyboard, but just the mouse). If you have any other remarks please let me know! You helped me making this PR better 👍 @scottnonnenberg: Can you try out the new changes and tell me what you think? PS: I've cleaned up my commits and did a |
4b997d2
to
d565321
Compare
@scottnonnenberg unfortunately I cannot sign the CLA 😞 is it a blocker? |
Looks like it did succeed - we just had a problem showing you a proper success page, which we're working on as we speak. You're good to go. :0) |
// FREEBIE
d565321
to
53748c8
Compare
Hey @scottnonnenberg, are you still interested in merging this? |
I just took a look at the latest code, and I have a couple concerns:
One solution to 1 and 3 is to add it to |
@scottnonnenberg thanks for your feedback. I'm quite busy now, will give it a shot next weekend if I find time :) |
I'm gonna close this until it gets some more attention. |
Solving this UX issue would be amazing. Right now it makes Signal's UX stand out among the other more popular messaging apps that figured out a way to keep/regain focus on the input field. |
@tosh Seems that we don't have a good design for how it should work. You seem to be familiar with other messaging apps; perhaps you have a recommendation for the right design here? (and when I say that, I mean an idea of how to handle all the corner cases involved) |
First time contributor checklist
Contributor checklist
FREEBIE
in my Git commit messagesDescription
Clicking on the discussion container (highlighted in red in the screenshot) now focus on the message box.I've added an event listener for
keydown
events that focuses the message box if nothing else has focus. Why? Because I don't have always the patience to go to the message box and click there 😃.PS: I have tried to sign the Contributor Licence Agreement but it doesn't work.