ignore arrows events when the textarea is selected

Fixes #1416
pull/1421/head
Audric Ackermann 4 years ago
parent 16c9bf27c9
commit d2fab26a5d
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -709,6 +709,9 @@ export class SessionCompositionBox extends React.Component<Props, State> {
await this.onSendMessage(); await this.onSendMessage();
} else if (event.key === 'Escape' && this.state.showEmojiPanel) { } else if (event.key === 'Escape' && this.state.showEmojiPanel) {
this.hideEmojiPanel(); this.hideEmojiPanel();
} else if (event.key === 'PageUp' || event.key === 'PageDown') {
// swallow pageUp events if they occurs on the composition box (it breaks the app layout)
event.preventDefault();
} }
} }

@ -307,6 +307,7 @@ export class SessionConversation extends React.Component<Props, State> {
/> */} /> */}
<div <div
// if you change the classname, also update it on onKeyDown
className={classNames( className={classNames(
'conversation-content', 'conversation-content',
selectionMode && 'selection-mode' selectionMode && 'selection-mode'
@ -888,6 +889,7 @@ export class SessionConversation extends React.Component<Props, State> {
} }
// EXIT WHAT ELSE? // EXIT WHAT ELSE?
} }
if (event.target.classList.contains('conversation-content')) {
switch (event.key) { switch (event.key) {
case 'Escape': case 'Escape':
if (selectionMode) { if (selectionMode) {
@ -910,6 +912,7 @@ export class SessionConversation extends React.Component<Props, State> {
default: default:
} }
} }
}
private clearAttachments() { private clearAttachments() {
this.state.stagedAttachments.forEach(attachment => { this.state.stagedAttachments.forEach(attachment => {

Loading…
Cancel
Save