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

Update Popup.OverlayDismissEventPassThrough default based on form factor #15669

Open
billhenn opened this issue May 9, 2024 · 0 comments
Open

Comments

@billhenn
Copy link
Contributor

billhenn commented May 9, 2024

Is your feature request related to a problem? Please describe.

Right now, the Popup.OverlayDismissEventPassThrough property default is always false. The new PopupFlyoutBase.OverlayDismissEventPassThrough added in PR is an additional owner of the Popup.OverlayDismissEventPassThrough property and therefore also defaults false.

The problem is that on desktop form factors, end users will expect click event pass-through to work, while on mobile form factors, end users will expect click event pass-through not to work. The behavior should be consistent through all popups and flyouts (which are based on popups) in the application for a given form factor.

To currently achieve click event pass-through on desktop, one must:

  • Retemplate all native and custom control themes to update their Popup usage to set OverlayDismissEventPassThrough="{OnFormFactor Default=False, Desktop=True}".
  • Update all Flyout usage throughout the application to do the same. However also noting that OnFormFactor might not even be available in code-behind for flyouts created in code-behind.

Having to do all this work to support expected click event pass-through per form factor is tedious and most people will not even know to do it. It would be better to bake logical defaults into the framework.

Describe the solution you'd like

It would be ideal for the default value of the Popup.OverlayDismissEventPassThrough property value to be based on the form factor so that no control themes or flyout declarations in apps would need alteration.

This can be done very simply by updating the Popup property's declaration like this:

public static readonly StyledProperty<bool> OverlayDismissEventPassThroughProperty =
  AvaloniaProperty.Register<Popup, bool>(nameof(OverlayDismissEventPassThrough), defaultValue: IsDesktopFormFactor());

private static bool IsDesktopFormFactor()
  => AvaloniaLocator.Current.GetRequiredService<IRuntimePlatform>().GetRuntimeInfo().IsDesktop;

The net result is that click event pass-through works out of the box for desktop form factors and remains disabled (like now) for non-desktop form factors. Nobody has to think about anything and it works as expected for end users by default.

Describe alternatives you've considered

No response

Additional context

The PR helped ensure that flyouts also could set the OverlayDismissEventPassThrough property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant