Semantic-Org / Semantic-UI

Semantic is a UI component framework based around useful principles from natural language.
http://www.semantic-ui.com
MIT License
51.1k stars 4.95k forks source link

[Dropdown] mutation observer should restore selection #6265

Open gama410 opened 6 years ago

gama410 commented 6 years ago

[Dropdown] mutation observer should restore selection

Steps

I use i18next with aurelia and when switching language, all static strings in the ui are updated. This includes the placeholders of all sui form elements. In the case of the dropdowns, the mutation observers see the modification to the

and recreate the component but the selection is not visually reapplied...

Expected Result

I would expect the selection to remain after changing the placeholder value of the component set in the

Actual Result

The component loses its selection and displays the placeholder instead

Version

2.3.0

Testcase

Kind of difficult to reproduce exactly, unfortunately...

y0hami commented 6 years ago

Have you tried using the refresh behavior https://semantic-ui.com/modules/dropdown.html#behavior

gama410 commented 6 years ago

thanks for your answer @hammy2899 ! unfortunately, this does not work... I tried to refresh the dropdown after changing the locale but nothing changed. The mutation observer already does that I think so it would be a bit redundant... I retrieved the selected value at the same time with the 'get value' behavior and it was correct, just not displayed...

any idea?

y0hami commented 6 years ago

How are you building the dropdown, can you provide some code showing the HTML you use?

gama410 commented 6 years ago

Sure!

My html looks like this: `