-
Notifications
You must be signed in to change notification settings - Fork 32
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
[Material][TextBox][PasswordBox] Add support for Label and Placeholder at the same time #974
Comments
If we replace the Label term with the TextBox Header property to have a better idea in the Material M3 Figma File.
(see the video below for a visual example of the Android Text Field using Material M3) Text.Field.Test.mp4 |
@NVLudwig fyi ^ this may mean some changes to the figma file |
I believe @NVLudwig is thinking it would be difficult to have the component behave in a Figma document to only have a Placeholder appear after the text has been focused As it stands now, I believe our Material styles don't react to the Focus state do they @Xiaoy312 / @agneszitte ? For the most part, I believe I've only ever seen the Placeholder "appearing" after the Label has animated upwards in that reference app that this video is from. In the real, world you usually just get a blank field after the Label has moved: ![]() ![]() plus I don't think I see that combination in the official M3 Google Figma, right? but I do agree having the Placeholder appear after the Label has moved is more difficult. The scenario I see it being useful is say we have a TextBox with the Label as "Phone Number", then when the field is focused, the "Phone Number" slides up and you are left with a placeholder of something like "(###) ###-####" to show the expected format. Or something like "Birthday" and "MM/DD/YYYY" |
In Material M2 page there's an example that shows Placeholder appearing after focus. @kazo0 There's a VisualState for focus in TextBox.xaml we could use if we're following this behavior. |
![]() ![]() I slightly prefer the originally agreed version where Placeholders are visible before the user interacts with the TextBox unless there was a previous input. Because It sets the expectation for the user before the field is focused and it's more likely that they will have read the instructions before typing (many people still look down at the keyboard while typing). This could also work for me (with a cursor in the second case) My only real blocker is having the label travel to the top of the box and mask the Outline because I don't think we can support it in Figma (@SMarengere any ideas?) |
The masking of the outline isn't done on the Uno.Material side either so we shouldn't have to worry about it right now. @agneszitte Is it going to be more difficult to have the Header and the Placeholder visible at the same time instead of the Placeholder only becoming visible on focus. Remember that right now we currently don't have this Focus state in Material so its out of scope for this particular feature. Here we just want to deal with display Header/Placeholder and what the visual states should be when there is no input text versus when there is input text. We can tackle the Focus state issue later |
We could move the animation from from NotEmpty VisualState to Focused VisualState. It would be something like:
The result: |
What do you mean by that @kazo0 ? The TextBox control itself as a Focus state by default and we are already using it for the Border for example
|
@agneszitte No I meant we currently don't support the animation of the Label/Header when the field is focused. For right now, we only seem to be animating the label when text is entered |
@kazo0 I may be missing something here, but I don't think of a technical blocker for us to achieve the wanted behavior. @NVLudwig with what you mentioned (cc @SMarengere) |
@NVLudwig so for this part you mentioned
So I will let you decide with @kazo0 what will be the final decision (cc @eriklimakc) |
So the final spec for this one would be:
Agreed? @agneszitte @Xiaoy312 @kazo0 @NVLudwig |
@NVLudwig / @kazo0 / @Xiaoy312 You can test the outcome of his current draft PR here: https://salmon-rock-0cfebe70f-1014.eastus2.azurestaticapps.net/ @kazo0 / @NVLudwig As I said previously, I will let you decide what will be the final decision for the wanted behavior. |
This is the way. ↑ Only change I would recommend is: we don't absolutely need to add the case where a TextBox has a Placeholder but no label. If it's extra work to make it leave that one out please, else it's not a huge sin. Reviewing the Figma File I noticed Placeholder is not longer in there, please correct this @SMarengere |
@NVLudwig for the case where a TextBox has a Placeholder but no label it will behave like a usual TextBox (matching Windows behavior). Meaning the Placeholder will be visible inside until some text is entered. It is not extra work, it is already what is in place in general. Remember that on the implementation:
|
Following @NVLudwig's request to have the other behavior, @eriklimakc I think it would be good to add some comments at the style level in the code to explicitly precise that we will go a different route than the Official Material M2/M3 Google samples & the Material doc regarding the fact that the Placeholder will always be visible. cf. With a Placeholder, the Label does not move, it is already at the top and shows also the Placeholder underneath until some text is entered |
What happens when there's Header but no Placeholder? Should the Header animate upwards when focused or when starting to type? |
@eriklimakc |
What would you like to be added:
Support for a Label as well as a PlaceholderText in TextBox controls. Right now we are using the PlaceholderText as the "Label" portion of the Material style. So, right now our Material style supports the Orange highlighted cases but we do not support the Red highlighted cases where we can have a PlaceholderText while still having a Label appear above
The text was updated successfully, but these errors were encountered: