Skip to content
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

Scroll to top on Tab click #30756

Open
3 tasks
rekilina opened this issue Oct 30, 2024 · 1 comment · May be fixed by #30837
Open
3 tasks

Scroll to top on Tab click #30756

rekilina opened this issue Oct 30, 2024 · 1 comment · May be fixed by #30837
Labels
dashboard:tab Related to the usage of tabs in the Dashboard

Comments

@rekilina
Copy link
Contributor

Bug description

Steps to reproduce bag:

  1. Create dashboard with nested tabs
  2. Open dashboard and scroll down
  3. Click on empty space inside the tab

Window will scroll to top.

Screenshots/recordings

Scroll.to.top.on.click.1080p.mp4

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Firefox

Additional context

It seems that problem originate from DashboardContainer.tsx file, onFocus prop of Tabs component.

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@dosubot dosubot bot added the dashboard:tab Related to the usage of tabs in the Dashboard label Oct 30, 2024
Copy link

dosubot bot commented Oct 30, 2024

Hey @rekilina! I'm here to help you with any bugs, questions, or contributions you have in mind. Let's squash this bug together!

To address the issue of the window scrolling to the top when clicking on an empty space inside a tab, you can modify the onFocus event handler in the DashboardContainer.tsx file. The current implementation scrolls the window to the top if certain conditions are met. You can prevent this behavior by commenting out or removing the window.scrollTo line:

onFocus={e => {
  if (
    e.target.classList.contains('ant-tabs-tabpane') &&
    window.scrollY < TOP_OF_PAGE_RANGE
  ) {
    // Comment out or remove the following line to prevent scrolling
    // window.scrollTo(window.scrollX, 0);
  }
}}

This change will stop the window from scrolling to the top when the tab pane is focused [1].

To continue talking to Dosu, mention @dosu.

@Srayash Srayash linked a pull request Nov 4, 2024 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard:tab Related to the usage of tabs in the Dashboard
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant