Fix clicking bookmark column header not scrolling to top in single-column

This commit is contained in:
Claire 2022-10-03 09:40:30 +02:00
parent b76cef6212
commit 22af8f7563

View file

@ -14,10 +14,11 @@ export default class Column extends React.PureComponent {
active: PropTypes.bool, active: PropTypes.bool,
hideHeadingOnMobile: PropTypes.bool, hideHeadingOnMobile: PropTypes.bool,
name: PropTypes.string, name: PropTypes.string,
bindToDocument: PropTypes.bool,
}; };
handleHeaderClick = () => { handleHeaderClick = () => {
const scrollable = this.node.querySelector('.scrollable'); const scrollable = this.props.bindToDocument ? document.scrollingElement : this.node.querySelector('.scrollable');
if (!scrollable) { if (!scrollable) {
return; return;
@ -27,7 +28,7 @@ export default class Column extends React.PureComponent {
} }
scrollTop () { scrollTop () {
const scrollable = this.node.querySelector('.scrollable'); const scrollable = this.props.bindToDocument ? document.scrollingElement : this.node.querySelector('.scrollable');
if (!scrollable) { if (!scrollable) {
return; return;