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

Required textfield do not apear red wen invalid is set #234

Closed
rafalou38 opened this issue Apr 28, 2021 · 1 comment
Closed

Required textfield do not apear red wen invalid is set #234

rafalou38 opened this issue Apr 28, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rafalou38
Copy link

rafalou38 commented Apr 28, 2021

Required textfield do not apear red wen invalid is set

Describe the bug

If you mark a text field as required and programmatically set it to be invalid it doesn't become red.

To Reproduce

  1. mark a Text Field as required
  2. add a way to change its invalid property
  3. text field doesn't become red until you click it

example code:

<script>
	import Switch from '@smui/switch';
	import Textfield from '@smui/textfield';
	import FormField from '@smui/form-field';

	let error = false;
	let value = 'test';
</script>

<h4>with required</h4>
<Textfield bind:value label="Password" invalid={error} required />
<br /><br />
<Textfield bind:value label="Password" invalid={error} required variant="filled" />
<br /><br /><br />
<h4>without required</h4>
<Textfield bind:value label="Password" invalid={error} />
<br /><br />
<Textfield bind:value label="Password" invalid={error} variant="filled" />
<br /><br /><br /><br />

<FormField align="end">
	<span slot="label">invalid</span>
	<Switch bind:checked={error} />
</FormField>

Expected behavior

Text Field should be red when invalid

Screenshots

invalidbug

Desktop:

  • OS: Windows
  • Browser: Firefox
  • Version: 90.0a1

repl

@rafalou38 rafalou38 added the bug Something isn't working label Apr 28, 2021
@hperrin hperrin self-assigned this Apr 28, 2021
@hperrin
Copy link
Owner

hperrin commented Apr 28, 2021

Wow! Very impressive bug report! Thank you for the sample code. It's making it much easier to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants