dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.79k stars 1.65k forks source link

[MacOSX][Entry] - Invisible cursor #15908

Open ZeProgFactory opened 11 months ago

ZeProgFactory commented 11 months ago

Description

At least on Mac OSX, if you change the BackgroundColor of the holding control on an Entry the Cursor color of this Entry won't follow the TextColor of the Entry. So you can get in situation where the cursor color is close to the BackgroundColor and though invisible.

(Observed on a Mac OSX with the system settings set to “Appearance Dark” )

Steps to Reproduce

  1.  On your Mac OSX set the system settings to “Appearance Dark”
  2. Generate a basic Maui App with VisualStudio
  3. Add an Entry to the VerticalStackLayout on the MainPage
  4. Play with the BackgroundColor of the VerticalStackLayout and the TextColor of the Entry.

Link to public reproduction project repository

https://github.com/ZeProgFactory/MacOSX-Entry-Invisible-cursor

Version with bug

7.0.49

Last version that worked well

Unknown/Other

Affected platforms

macOS, I was not able test on other platforms

Affected platform versions

OSX Ventura 13.4.1

Did you find any workaround?

No response

Relevant log output

No response

drasticactions commented 11 months ago

I do not believe this is a bug with MAUI; this is the default behavior of the platform.

You've set the background color of an underlying control to a color that can collide with the default selector control of an entry field. This is the same behavior that would happen if you used a UILabel inside of a UIView and set its color to match. UIKit doesn't know the overridden colors of controls to update its styles automatically (Beyond system defaults like Dark/Light mode) so this is something you, as the developer, would need to handle if you wanted to control the colors of your application fully.

That said, I do think there is a bug: If you override your "UserAppTheme" to Light, that should force the cursor to match the "Light" theme and switch to Black. It doesn't.

スクリーンショット 2023-06-30 17 10 29

If your usecase where you are overriding colors that don't match with the defaults on the system (A light color on a dark theme system) the underlying controls should at least sync when you have set the general theme to match your color scheme, and that doesn't seem to be happening.

QianaJiao commented 4 months ago

Verified this issue with Visual Studio for mac 17.6.8 (build 400). Can repro on iOS platforms with sample project. But not sure if this is a bug. https://github.com/ZeProgFactory/MacOSX-Entry-Invisible-cursor