Skip to content

fix: Data browser not scrolling to top when changing filter while cell selected #2821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 23 additions & 14 deletions src/dashboard/Data/Browser/Browser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -1904,32 +1904,41 @@ class Browser extends DashboardView {
params={this.props.location?.search}
linkPrefix={'browser/'}
filterClicked={url => {
// Reset to page 1
this.setState({
skip: 0,
});

this.resetPage();
this.props.navigate(generatePath(this.context, url));
}}
removeFilter={filter => {
// Reset to page 1
this.setState({
skip: 0,
});

this.resetPage();
this.removeFilter(filter)
}}
classClicked={() => {
// Reset to page 1
this.setState({
skip: 0,
});
this.resetPage();
}}
categories={allCategories}
/>
);
}

/**
* Resets the page to the first page of results and scrolls to the top.
*/
resetPage() {
// Unselect any currently selected cell and cancel editing action
this.dataBrowserRef.current.setCurrent(null);
this.dataBrowserRef.current.setEditing(false);

// Scroll to top
window.scrollTo({
top: 0,
behavior: 'smooth'
});

// Reset pagination to page 1
this.setState({
skip: 0,
});
}

showNote(message, isError) {
if (!message) {
return;
Expand Down
Loading