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

[Android] Combobox dropdown placement can be a bit misaligned vertically #10339

Closed
takla21 opened this issue Nov 4, 2022 · 4 comments · Fixed by #11206
Closed

[Android] Combobox dropdown placement can be a bit misaligned vertically #10339

takla21 opened this issue Nov 4, 2022 · 4 comments · Fixed by #11206
Assignees
Labels
area/popups 💬 Categorizes an issue or PR as relevant to popups or flyouts difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform

Comments

@takla21
Copy link
Contributor

takla21 commented Nov 4, 2022

Current behavior

When the app is configured with a shell as a UserControl while also activating translucent, the Combobox dropdown always misaligned itself vertically

Screenshot_20221104-105032

Shell.xaml

<UserControl x:Class="Comboboxplacement.Shell"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:local="using:Comboboxplacement">

	<Frame x:Name="NavigationFrame" />
</UserControl>

Android Style.xml

<?xml version="1.0" encoding="utf-8" ?>
<resources>
	<style name="AppTheme" parent="Theme.AppCompat.Light">

		<!-- This makes the status bar translucent and allows content to be drawn behind -->
		<item name="android:windowTranslucentStatus">true</item>
		
		<!-- This removes the ActionBar -->
		<item name="windowActionBar">false</item>
		<item name="android:windowActionBar">false</item>
		<item name="windowNoTitle">true</item>
		<item name="android:windowNoTitle">true</item>

	</style>
</resources>

Expected behavior

Screenshot_20221104-105052

How to reproduce it (as minimally and precisely as possible)

Workaround

Setting Uno.UI.FeatureConfiguration.Popup.UseNativePopup to true fix the misalignment issue. Which, this bug was also happening before UseNativePopup was changed to false by default.

Which could also introduce this bug #9004

Works on UWP/WinUI

No response

Environment

Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia

NuGet package version(s)

4.7.0-dev.60

Affected platforms

Android

IDE

Visual Studio 2022

IDE version

17.3.5

Relevant plugins

No response

Anything else we need to know?

No response

@takla21 takla21 added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform labels Nov 4, 2022
@jeromelaban jeromelaban added area/popups 💬 Categorizes an issue or PR as relevant to popups or flyouts and removed triage/untriaged Indicates an issue requires triaging or verification labels Nov 4, 2022
@jeromelaban
Copy link
Member

Note for contributor

The positioning of popups is likely not taking Window.VisibleBounds into account, as well as the keyboard position to determine the values.

@MartinZikmund
Copy link
Member

MartinZikmund commented Jan 31, 2023

I have checked the code, but it seems it is taking VisibleBounds into account correctly - or rather as the status bar is translucent, the visible bounds technically do include its area. And there is specifically a code that shifts the popup by the status bar height in such case. Now the question is what is the correct behavior. As marking the status bar translucent technically means that we want the view to "extend" under it, so popups do get arranged there and that seems to be correct, or not? @jeromelaban I see you added these lines, so maybe you remember what was the main reason:

// Compensate for origin location is some popup providers (Android
// is one, particularly when the status bar is translucent)
frame.X -= offset.X;
frame.Y -= offset.Y;

If the behavior is correct, maybe it should also extend to popups in general, not be ComboBox specific

What is definitely incorrect is that the combo should probably open up down instead of center on top of the box - I need to investigate why it happens this way currently.

@jeromelaban
Copy link
Member

@MartinZikmund I don't recall specifically what the reason was at that time, but it may also be a mix of Native vs XAML specific tests. At least, there's a UI test for it :)

@jeromelaban
Copy link
Member

Now with regards to displaying under the translucent bar, It would make sense for ComboBox popups to not extend under the bar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/popups 💬 Categorizes an issue or PR as relevant to popups or flyouts difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants