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

Fix issue with tabbed content underline #2274

Closed
wants to merge 1 commit into from

Conversation

rodrigogiraoserrao
Copy link
Contributor

I did some investigation around #2229 and I figured out the issue is related to the fact that it takes a lot of time to swap in and out the contents of the tabbed content.
Commenting out this line makes the issue go away:

switcher.current = event.tab.id

That's called when the message Tabs.TabActivated is handled in TabbedContent, and that message is coming from Tabs.watch_active.

A simple fix would be to throttle Tabs.watch_active so that it doesn't get called too often.
That is what this PR does, and merging it will close #2229.

Another possible solution, that is more involved, is to add a task-based mechanism around swapping the visible sub-widget of the ContentSwitcher in ContentSwitch.watch_current, such that when we schedule a new switch, old ones get thrown away.

Copy link
Collaborator

@willmcgugan willmcgugan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it might be masking the error, rather than fixing it. I don't think you guarantee that time mechanism won't fail on a slower machine or with faster key repeat.

Have you established why this occurs?

src/textual/widgets/_tabs.py Show resolved Hide resolved
@rodrigogiraoserrao
Copy link
Contributor Author

This feels like it might be masking the error, rather than fixing it. [...]

Sadly, I share this sentiment.

Have you established why this occurs?

Not really... I will dig some more.

@rodrigogiraoserrao rodrigogiraoserrao self-assigned this Apr 13, 2023
@rodrigogiraoserrao rodrigogiraoserrao marked this pull request as draft April 13, 2023 14:26
@rodrigogiraoserrao
Copy link
Contributor Author

Closing this because the actual fix (coming soon) is unrelated to this throttling attempt.

@rodrigogiraoserrao rodrigogiraoserrao deleted the broken-underline branch September 19, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It's possible to somehow break the working of TabbedContent
2 participants