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

[NEW] close emoji box using Keyboard Escape key #13956

Merged
merged 5 commits into from
Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion app/emoji/client/emojiPicker.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="rc-input__icon">
{{> icon block="rc-input__icon-svg" icon="magnifier" }}
</div>
<input name="name" type="text" class="rc-input__element js-emojipicker-search" placeholder="{{_ "Search"}}" autocomplete="off">
<input name="name" type="text" class="rc-input__element js-emojipicker-search" placeholder="{{_ "Search"}}" autofocus autocomplete="off">
</div>
</label>
</div>
Expand Down
5 changes: 4 additions & 1 deletion app/ui-message/client/messageBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ Template.messageBox.onCreated(function() {
this.isMicrophoneDenied = new ReactiveVar(true);
this.sendIconDisabled = new ReactiveVar(false);
messageBox.emit('created', this);
window.addEventListener('keydown',function(e){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the best place to do this code. @ggazzo / @tassoevan can you please advise the best place to do this?

@mohamedar97 also this code is not following our code style. please run meteor npm run lint before pushing your changes.

if(e.key==='Escape'){
EmojiPicker.close()}
})

navigator.permissions.query({ name: 'microphone' })
.then((permissionStatus) => {
Expand Down Expand Up @@ -314,7 +318,6 @@ Template.messageBox.events({

const caretPos = input.selectionStart;
const textAreaTxt = input.value;

input.focus();
if (!document.execCommand || !document.execCommand('insertText', false, emojiValue)) {
input.value = textAreaTxt.substring(0, caretPos) + emojiValue + textAreaTxt.substring(caretPos);
Expand Down
Loading