-
Notifications
You must be signed in to change notification settings - Fork 980
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
Added PlaceholderText functionality to TextBox control #96
Conversation
Added NullText functionality to TextBox control
Please determine if the contrast ration between the NullText and the background color is a minumum of 4.5.1 as described here. This is a minimum compliance requirement for accessibility. I see that you're using SystemColors.GrayText, which should adjust properly in HighContrast modes. But it is also required that all text in the UI meet the minimum contrast ratios. Please also ensure that the text of the property is made available to accessibility tooling so that Narrator can announce the the text when running. |
I'd like to consider an alternative name to the property. Perhaps PlaceholderText? |
PlaceHolderText and WatermarkText seem to be more common. Also I assume it'll also show when it's empty and not null. |
PlaceholderText sounds great and yes, it will change when null or empty. |
@merriemcgaw I have checked and the contrast ration between SystemColors.GrayText (#6D6D6D) and the White (#ffff) background is 5.15:1 I will also make sure to return the PlaceholderText property value in the AccessibleObject, when the control has no text. But have in mind, that the narrator will probably not be able to read this text, as the PlaceholderText disappears when the control take focus. |
Replaced NullText with Placeholdertext and added accessibility support
hey @dotMorten just flagging with No Merge until we go open (trying to avoid someone accidentally pushing the button). I wouldn't want anyone to pull the "pull" level on accident |
@stefanov-stefan The PR is really adding new API. All new APIs in .NET Coreare required to go through API approval process first and should follow the Issue Guide as well. . |
@merriemcgaw the issue is added: #134 Let me know if you need anything else. |
@stefanov-stefan Please close and reopen this PR to trigger the CI build again. Sorry for the inconvenience. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stefanov-stefan thank you for the feature! We need to keep this in the future milestone until we get a functional test infrastructure stood up for Core so that you can add functional tests. I'd also really like to see some unit tests given our lack of coverage in the TextBox, especially over the code paths added.
Could you also attach screenshots of it running on a Per-Monitor DPI Aware application before and after it's been dragged from 100% scaling monitor to 300% scaling.
Had you checked ratio for all high contrast modes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, please add unit tests, add the new API to the ref assembly and proceed with the API review.
Thank you!
I am really excited about this new feature! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are surfacing a new property publicly here (PlaceholderText), I think we need to update the reference assembly definition in this case? @AdamYoblick , @Shyam-Gupta , @zsd4yr , @Tanya-Solyanik - until know, I patched System.Windows.Forms.cs in \winforms\src\System.Windows.Forms\ref manually. Is this best practice? Is there still an automatic process where I could generate the updated RefAssembly source for example with /t:GenerateReferenceSource?
Edit:
I just saw #175, and I like that a lot! Still, we'd need the updated reference assembly as part of this PR, I suppose.
Yeah once #175 is done this should not be an issue |
@Tanya-Solyanik i have addressed your reviews and pushed a new commit. Below you can see how it looks on 100% scale, on 200% scale and then back on 100% scale - it is pixel perfect. @KlausLoeffelmann I have added the property with its arttributes in the System.Windows.Forms.cs file in the ref project. Is there is anything else I gotta add here? |
Hey Stefan, Thanks for the screenshots! Can you check, though, if those are rendered Said that, it looks like the Window is |
I attempted to run the CI with close and reopen, however when i closed git is not playing well with be and does not allow me to reopen. Can someone reopen this PR? @merriemcgaw @Tanya-Solyanik |
VisualStyles are enabled as is by default. The app I am testing with is in the winforms sln WinformsControlsTests project. Here is the branch where I work: https://github.com/stefanov-stefan/winforms/tree/TextBox-NullText Could you please clarify why they are not OK? |
When you create a new WinForms Core App based on the latest build, and enable SystemAware, does it render correctly? Is your demo app VB or C# (there might be a problem with VB)? |
I am in FX app, not core with C#. Above I indicated the app I am using - it is the one included in the System.Windows.Forms.sln |
I'm curious, what's the advantage over using the SendMessage described above? Wouldn't this come with High-DPI support for free? |
@stefanov-stefan I'm trying to reopen this PR and I'm not able to, even as a repo admin. :( |
I think it is, because it was created when the repo was private. @raffaeler ran into the same thing and had to recreate his PR. |
@AdamYoblick I can confirm. It was a pain because my repo lost the status of |
I wonder if making the fork public would help restore the relationships and everything ... didn't try it myself though. |
I made it public, but it did not help. Will go over the process again and make new PR, however, the project from master is no longer building due to missing types from System.Security.Permissions. Once it is back up and running i will get the new PR. Thanks |
Since MSFT owns GitHub now, you should definitely feed this problem back to them and get it fixed. |
@bergmeister I don't think that statement differs if MS owns GH or not. It is feedback which should be sent there. |
(fyi: I sent the feedback) |
I sent it too back when I experienced it, so I hope it will be taken into consideration. |
Sorry for the late response and thank you for taking the time to send the feedback :) |
Can't we change this for 6? (And make it virtual along the way?) |
Added TextBox NullText support.