[Glitch] Fix clicking “Explore” or “Live feeds” column headers to scroll in advanced mode

Port b63ddc70d6 to glitch-soc

Co-authored-by: Plastikmensch <Plastikmensch@users.noreply.github.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
lolsob-rspec
Claire 2023-08-24 14:10:48 +02:00
parent a7a9e2854d
commit 9bc91160b2
1 changed files with 13 additions and 1 deletions

View File

@ -18,7 +18,19 @@ export default class Column extends PureComponent {
};
scrollTop () {
const scrollable = this.props.bindToDocument ? document.scrollingElement : this.node.querySelector('.scrollable');
let scrollable = null;
if (this.props.bindToDocument) {
scrollable = document.scrollingElement;
} else {
scrollable = this.node.querySelector('.scrollable');
// Some columns have nested `.scrollable` containers, with the outer one
// being a wrapper while the actual scrollable content is deeper.
if (scrollable.classList.contains('scrollable--flex')) {
scrollable = scrollable?.querySelector('.scrollable') || scrollable;
}
}
if (!scrollable) {
return;