Skip to content

Add focusable parameter to Flyout and defaults to true #123

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Konyaco
Copy link
Collaborator

@Konyaco Konyaco commented Jun 14, 2025

The focusable parameter in PopupProperties controls certain interaction behaviors, particularly for components like Dialog, Flyout, and Dropdown. Previously, setting it to false allowed users to click the DropdownButton multiple times, which causes animation problems.

However, some components do require this behavior. For example, a MenuBar needs to be able to display a new menu immediately when the user hovers over another menu button.

So, I exposed this parameter, allows components to choose the expected behavior.

Meanwhile, adjusted the focusable setting for Dialog specifically, as Dialog components also need to handle keyboard interactions from users.

… Popup behavior.

Introduced a `focusable` parameter to the `Flyout`, `MenuFlyout`, and related components to control whether the flyout is focusable. This allows interaction with areas outside the flyout when set to `false`. Updated default focus behavior across components for consistency. Adjusted `FluentDialog` and `Dropdown` to align with the new focusable defaults.
@Konyaco Konyaco requested a review from Sanlorng June 14, 2025 14:17
@@ -221,6 +229,7 @@ internal fun BasicFlyout(
positionProvider: FlyoutPositionProvider = rememberFlyoutPositionProvider(),
onKeyEvent: ((keyEvent: KeyEvent) -> Boolean)? = null,
onPreviewKeyEvent: ((keyEvent: KeyEvent) -> Boolean)? = null,
focusable: Boolean = true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
focusable: Boolean = true,
focusable: Boolean = onKeyEvent != null || onPreviewKeyEvent != null,

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.

2 participants