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]: sbb-select options missrendered and not clickable #3005

Closed sebastianfiechter closed 1 month ago

sebastianfiechter commented 1 month ago

Preflight Checklist

Bug type

Functionality

It affects the following packages

Components

Which version of Lyne Components are you using

1.7.0

Operating system

Windows 10

Browser / Browser version

Google Chrome 127.0.6533.120

Input mode

Mouse/Keyboard

Additional settings

No response

What happened?

Hi,

we see a strange behaviour on sbb-option rendering and believe it's a lyne bug. Option elements are rendered, but with almost no html attributes nor required generated child tags.

The following code often fails, e.g. on https://knotenkenntnisse-dev.app.sbb.ch/BN: ` <sbb-select (change)="changeGdbVersion($customEvent($event))"> @for (gdbVersion of versions; track gdbVersion) { <sbb-option [value]="gdbVersion" [selected]="currentGdbVersion() === gdbVersion"

{{ gdbVersion }}</sbb-option

} `

see (also the code part on the right side): options-wrong

We cannot select an option in this case.

We would expect to have it rendered and clickable like this: options-correct

If we use a bare HTML select with options, it always works:

`<select style="width: 300px" (change)="changeGdbVersion($customEvent($event))"

@for (gdbVersion of versions; track gdbVersion) { <option [value]="gdbVersion" [selected]="currentGdbVersion() === gdbVersion"

{{ gdbVersion }} } `

see: options-bareselect

What is special, that it always works with lyne components on the homepage of KK: https://knotenkenntnisse-dev.app.sbb.ch/ We believe it's a timing problem, so when data arrives too late, the rendering is broken.

Thank you very much for your support!

Sebastian (sebastian.fiechter@sbb.ch)

Steps to reproduce the issue

  1. Go to https://knotenkenntnisse-dev.app.sbb.ch/ and authenticate
  2. Navigate to https://knotenkenntnisse-dev.app.sbb.ch/BN
  3. Open the context menue by clicking on the "Hamburger" on the top left side
  4. Click on the Select dropdown

Relevant log output

No response

jeripeierSBB commented 1 month ago

As the Shadow DOM is not present, it looks like the option is not loaded there. Can you send me a link to your repo? Could it be that somehow the module is not imported?

sebastianfiechter commented 1 month ago

Thanks for your fast reply! Here's the code https://code.sbb.ch/projects/KD_KK/repos/knotenkenntnisse-frontend/browse/src/app/app.component.html Well, on the Starting-Page/Homepage it's always working, so I don't guess the module is not imported. Sometimes it even works on every page.

Here's a working example on a separate branch with Menu instead of Select that seems to work always (not deployed yet): https://code.sbb.ch/projects/KD_KK/repos/knotenkenntnisse-frontend/browse/src/app/app.component.html?at=refs%2Fheads%2Fbugfix%2FWIAS-16312-auswahl-von-gis-branches-select-zeigt-falsche-optionen-an

jeripeierSBB commented 1 month ago

missing import found by common call