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

Text field required asterisk should be optional #5256

Closed
summersz opened this issue Dec 5, 2023 · 4 comments
Closed

Text field required asterisk should be optional #5256

summersz opened this issue Dec 5, 2023 · 4 comments

Comments

@summersz
Copy link

summersz commented Dec 5, 2023

What is affected?

Component

Description

According to the md3 docs the required asterisk on the label text should not be present once the field has a value:
https://m3.material.io/components/text-fields/guidelines#9ad90554-a793-4506-9075-6812fd7b381a

There should also be a way to choose if you want the asterisk to show at all, as per https://m3.material.io/components/text-fields/guidelines#6c36a812-273d-4f5d-9102-2f00386c9145 for when you want to highlight the optional fields and not required ones.- I couldn't see a way to do this in docs.

Reproduction

N/A

Workaround

N/A

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

Nightly

Browser/OS/Node environment

Edge Version 119.0.2151.97 (Official build) (64-bit)

@asyncLiz
Copy link
Collaborator

asyncLiz commented Dec 5, 2023

We'll check in with design to see what the intended behavior is.

The second link provided to the spec indicates that the required asterisk must be present on required fields.

To indicate that a field is required, display an asterisk (*) next to the label text and mention in supporting text that the asterisks indicate required fields.

The first link provided to the error text video demonstrates the asterisk disappearing, but that may be an incorrect video asset. The spec text does not explicitly say that the asterisk is optional.

@summersz
Copy link
Author

summersz commented Dec 6, 2023

If most fields are required, indicate optional fields by displaying the word “optional” in parentheses next to the label text

This line implies that if most or all fields are required then it would be better to highlight the optional ones instead of highlighting required fields - at least that is my understanding.

I agree, it could be a mistake in the video asset. It looks strange to have it there without the *required supporting-text however, like when it changes to an error message. but then equally odd if you have the *required supporting-text and no asterisk in the label when it is filled out.

@asyncLiz
Copy link
Collaborator

asyncLiz commented Dec 6, 2023

Thanks for investigating this! I confirmed with design that the required asterisk * is optional provided there are other affordances such as supporting text that indicate required vs non-required fields.

I think noAsterisk would be a good boolean name for the flag. Do you want to try opening a PR? Just need to add the property and check it when we're adding an asterisk.

@property({type: Boolean, attribute: 'no-asterisk'}) noAsterisk = false;
<md-outlined-text-field label="Name" required no-asterisk></md-outlined-text-field>

@asyncLiz asyncLiz changed the title Populated label text should not have the required asterisk Text field required asterisk should be optional Dec 15, 2023
@npeters-dev
Copy link
Contributor

This issue can be closed, as it is solved.

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

Successfully merging a pull request may close this issue.

3 participants