When selecting a toot via keyboard, ensure it is scrolled into view

This commit is contained in:
Thibaut Girka
2019-04-15 20:40:05 +02:00
committed by ThibG
parent fbec0edf08
commit 8d57c0e70e
3 changed files with 27 additions and 10 deletions

View File

@@ -341,11 +341,16 @@ export default class UI extends React.Component {
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();
}
}