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: Prevent StyledWidgets from being focusable by default #551

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tilucasoli
Copy link
Collaborator

@tilucasoli tilucasoli commented Jan 21, 2025

Description

By default, all StyledWidgets are focusable, even in cases where they shouldn’t be. In vanilla Flutter, a Container is not focusable unless explicitly wrapped with another widget to enable focus. This PR aims to replicate that behavior in StyledWidgets, making them focusable only when a FocusableVariant is explicitly defined in their style. This change aligns StyledWidgets with expected Flutter behavior, providing better control over focusable elements.

Changes

  • Fix canRequestFocus property on Interactive;
  • Add a logic in StyledSpec to only set canRequestFocus when needed
  • Add some tests

Review Checklist

  • Testing: Have you tested your changes, including unit tests and integration tests for affected code?
  • Breaking Changes: Does this change introduce breaking changes affecting existing code or users?
  • Documentation Updates: Are all relevant documentation files (e.g. README, API docs) updated to reflect the changes in this PR?
  • Website Updates: Is the website containing the updates you make on documentation?

@tilucasoli tilucasoli requested a review from leoafarias January 21, 2025 16:09
Copy link

vercel bot commented Jan 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
mix-docs ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2025 9:06pm

@github-actions github-actions bot added the mix label Jan 21, 2025
@tilucasoli tilucasoli changed the title fix: canRequestFocus property on InteractiveMixStateWidget fix: Prevent StyledWidgets from being focusable by default Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant