sbb-design-systems / lyne-components

Components for Lyne Design System
https://lyne-storybook.app.sbb.ch
MIT License
45 stars 13 forks source link

[Bug]: SbbDatepicker - sbb-invalid does not work in React Components #1851

Closed k-luise closed 4 months ago

k-luise commented 1 year ago

Preflight Checklist

Bug type

Functionality

It affects the following packages

Components

Which version of Lyne Components are you using

0.35.18

Operating system

No response

Browser / Browser version

No response

Input mode

None

Additional settings

No response

What happened?

When using a SbbDatepicker in a SbbFormField it is not possible to display the error state with "class="sbb-invalid"" .

There should be a red frame around the input and the text should be red also.

Steps to reproduce the issue

Use the following code:

  <SbbFormField>
     <SbbDatepickerPreviousDay />
     <SbbDatepickerToggle />
     <SbbDatepicker />
     <input class="sbb-invalid" data-testid="date input" />
     <SbbDatepickerNextDay />
   </SbbFormField>

Relevant log output

No response

jeripeierSBB commented 1 year ago

In browser it's working. @k-luise Will update if she has more information.

kyubisation commented 1 year ago

With https://github.com/lyne-design-system/lyne-components/blob/master/src/components/sbb-datepicker/sbb-datepicker.tsx#L242 it is never checked, whether the new date is actually valid and the sbb-invalid is removed anyway