0
0
Fork 0

When selecting a toot via keyboard, ensure it is scrolled into view (#10593)

This commit is contained in:
ThibG 2019-05-03 06:20:36 +02:00 committed by Eugen Rochko
parent 05ef3462ba
commit 5121d9c12f
5 changed files with 51 additions and 22 deletions

View file

@ -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();
}
}