aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorkimsible <kimsible@users.noreply.github.com>2020-11-17 15:45:06 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-18 09:08:21 +0100
commitaa9cf3b98d5db85fefce918bb29840d0cdcb84c4 (patch)
treef1aecef6c151a207772c2eb7f5368c3cab20497d /client/src/app
parent363726fe9aedfad3c5c4c593f4e5b7a92656c090 (diff)
downloadPeerTube-aa9cf3b98d5db85fefce918bb29840d0cdcb84c4.tar.gz
PeerTube-aa9cf3b98d5db85fefce918bb29840d0cdcb84c4.tar.zst
PeerTube-aa9cf3b98d5db85fefce918bb29840d0cdcb84c4.zip
Disable auto-focus markdown textarea on touchdevices
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/shared/shared-forms/markdown-textarea.component.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/client/src/app/shared/shared-forms/markdown-textarea.component.ts b/client/src/app/shared/shared-forms/markdown-textarea.component.ts
index d47f22d1d..b626071eb 100644
--- a/client/src/app/shared/shared-forms/markdown-textarea.component.ts
+++ b/client/src/app/shared/shared-forms/markdown-textarea.component.ts
@@ -4,7 +4,7 @@ import { Subject } from 'rxjs'
4import { debounceTime, distinctUntilChanged } from 'rxjs/operators' 4import { debounceTime, distinctUntilChanged } from 'rxjs/operators'
5import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@angular/core' 5import { Component, ElementRef, forwardRef, Input, OnInit, ViewChild } from '@angular/core'
6import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' 6import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
7import { MarkdownService } from '@app/core' 7import { MarkdownService, ScreenService } from '@app/core'
8 8
9@Component({ 9@Component({
10 selector: 'my-markdown-textarea', 10 selector: 'my-markdown-textarea',
@@ -40,6 +40,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
40 40
41 constructor ( 41 constructor (
42 private viewportScroller: ViewportScroller, 42 private viewportScroller: ViewportScroller,
43 private screenService: ScreenService,
43 private markdownService: MarkdownService 44 private markdownService: MarkdownService
44 ) { } 45 ) { }
45 46
@@ -80,7 +81,10 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
80 this.isMaximized = !this.isMaximized 81 this.isMaximized = !this.isMaximized
81 82
82 // Make sure textarea have the focus 83 // Make sure textarea have the focus
83 this.textareaElement.nativeElement.focus() 84 // Except on touchscreens devices, the virtual keyboard may move up and hide the textarea in maximized mode
85 if (!this.screenService.isInTouchScreen()) {
86 this.textareaElement.nativeElement.focus()
87 }
84 88
85 // Make sure the window has no scrollbars 89 // Make sure the window has no scrollbars
86 if (!this.isMaximized) { 90 if (!this.isMaximized) {