Fix .find is not available from QSA

This commit is contained in:
Lim Chee Aun 2024-12-22 09:25:46 +08:00
parent 1bb8c0de3e
commit 27e7eef04b

View file

@ -8,12 +8,12 @@ const focusDeck = () => {
focusedColumn.focus();
} else {
// Focus first column within viewport
const firstVisibleColumn = columns
.querySelectorAll('.deck-container')
.find((column) => {
const columnRect = column.getBoundingClientRect();
return columnRect.left >= 0;
});
const firstVisibleColumn = Array.from(
columns.querySelectorAll('.deck-container'),
).find((column) => {
const columnRect = column.getBoundingClientRect();
return columnRect.left >= 0;
});
if (firstVisibleColumn) {
firstVisibleColumn.focus();
} else {