about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/ui/index.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-05-03 06:20:36 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-05-03 06:20:35 +0200
commit5121d9c12f39e95eaef630dd6c98b736cb76c4c0 (patch)
tree3496166b8fa1755392e008900fe80a84b7bedfb1 /app/javascript/mastodon/features/ui/index.js
parent05ef3462ba0af7b147a7cfa8de2735e99dc59ac5 (diff)
When selecting a toot via keyboard, ensure it is scrolled into view (#10593)
Diffstat (limited to 'app/javascript/mastodon/features/ui/index.js')
-rw-r--r--app/javascript/mastodon/features/ui/index.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js
index 93e45678f..c14eba992 100644
--- a/app/javascript/mastodon/features/ui/index.js
+++ b/app/javascript/mastodon/features/ui/index.js
@@ -367,11 +367,16 @@ class UI extends React.PureComponent {
   handleHotkeyFocusColumn = e => {
     const index  = (e.key * 1) + 1; // First child is drawer, skip that
     const column = this.node.querySelector(`.column:nth-child(${index})`);
+    if (!column) return;
+    const container = column.querySelector('.scrollable');
 
-    if (column) {
-      const status = column.querySelector('.focusable');
+    if (container) {
+      const status = container.querySelector('.focusable');
 
       if (status) {
+        if (container.scrollTop > status.offsetTop) {
+          status.scrollIntoView(true);
+        }
         status.focus();
       }
     }