fixed #71 : input autofocus on touch devices
authorunknown <ajbura@gmail.com>
Wed, 25 Aug 2021 08:10:38 +0000 (13:40 +0530)
committerunknown <ajbura@gmail.com>
Wed, 25 Aug 2021 08:10:38 +0000 (13:40 +0530)
src/app/organisms/channel/ChannelViewInput.jsx
src/client/state/settings.js

index 6e5deb0433c353521032e04ba484f0a1f8ab5476..773b47d02ccb4888bfaeacec9bddbbaad4e0ddf4 100644 (file)
@@ -134,6 +134,7 @@ function ChannelViewInput({
   }
 
   function focusInput() {
+    if (settings.isTouchScreenDevice) return;
     textAreaRef.current.focus();
   }
 
index fcbf4bea7edae0162fd63b8290dc1c344c4c05dd..9516d86893f8996ae3245b5f794d2a318dc72053 100644 (file)
@@ -24,6 +24,8 @@ class Settings extends EventEmitter {
     this.themeIndex = this.getThemeIndex();
 
     this.isMarkdown = this.getIsMarkdown();
+
+    this.isTouchScreenDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0);
   }
 
   getThemeIndex() {