Skip to content

fix: enforce disabled state across Tabs, TabBar, Tab and TabBarView#6224

Open
ndonkoHenri wants to merge 3 commits intomainfrom
disabled-tab
Open

fix: enforce disabled state across Tabs, TabBar, Tab and TabBarView#6224
ndonkoHenri wants to merge 3 commits intomainfrom
disabled-tab

Conversation

@ndonkoHenri
Copy link
Contributor

@ndonkoHenri ndonkoHenri commented Feb 27, 2026

Fix #6220

Summary by Sourcery

Enforce disabled state behavior across Tabs, TabBar, Tab, and TabBarView and add coverage for these scenarios.

Bug Fixes:

  • Prevent disabled tabs and tab bars from changing selection or emitting click/hover events.
  • Disable swiping between views when TabBarView is disabled by its parent Tabs control.

Tests:

  • Add integration tests verifying disabled behavior for individual tabs, the entire TabBar, and the Tabs container.
  • Adjust tabs integration test setup to create a fresh Flet app per test function for isolation.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine

@cloudflare-workers-and-pages
Copy link

Deploying flet-examples with  Cloudflare Pages  Cloudflare Pages

Latest commit: 16fd873
Status: ✅  Deploy successful!
Preview URL: https://79663b13.flet-examples.pages.dev
Branch Preview URL: https://disabled-tab.flet-examples.pages.dev

View logs

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a regression bug (#6220) where disabling tab buttons in Flet 0.80.*/0.81.0 did not work as expected. The fix enforces the disabled state across the entire Tabs component hierarchy (Tabs, TabBar, Tab, and TabBarView).

Changes:

  • Added comprehensive disabled state handling in Dart implementation for TabBar, individual Tabs, and TabBarView
  • Added three new integration tests to verify disabled state behavior at different levels
  • Updated existing tests to use function-scoped fixtures for better test isolation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
sdk/python/packages/flet/integration_tests/controls/material/test_tabs.py Added function-scoped fixture override and three comprehensive tests for disabled state (individual tab, TabBar, and Tabs control)
packages/flet/lib/src/controls/tabs.dart Implemented disabled state enforcement: TabBarView prevents scrolling, TabBar uses IgnorePointer wrapper, and onTap/onHover handlers check individual tab disabled states

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cloudflare-workers-and-pages
Copy link

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 16fd873
Status: ✅  Deploy successful!
Preview URL: https://54548dca.flet-docs.pages.dev
Branch Preview URL: https://disabled-tab.flet-docs.pages.dev

View logs

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.

bug: Cannot disable tab buttons in flet 0.80.* / 0.81.0

2 participants