ing-bank / lion

Fundamental white label web component features for your design system.
https://lion.js.org
MIT License
1.77k stars 295 forks source link

[LionTextarea] modelValueChanged does not get triggered for the first textarea when chrome plugin LanguageTool is on #2375

Closed AndreeaMoise closed 2 weeks ago

AndreeaMoise commented 2 months ago

Expected behavior

The modelValueChanged event triggers on all textarea when chrome plugin AI Grammar Checker & Paraphraser – LanguageTool is installed.

Actual Behavior

Having the plugin enabled, the modelValueChange event is not triggered for the first textarea in the page, but it is triggered for a second, third, nth textarea. When the plugin is disabled, everything works correctly.

Sandbox here: https://codesandbox.io/p/sandbox/web-components-playground-forked-23yt3g

Additional context

This is a snippet of the model values when the plugin is enabled. The first one is not up to date, the rest yes. image

It is possible that the issue lies on the plugin's side, but maybe you are already aware of a workaround that I could try.

rajithaeyee commented 3 weeks ago

@AndreeaMoise you can look at this workaround to get rid of the unexpected behaviour. You are right about it, it's what the plugin does. Updated code sandbox here : https://codesandbox.io/p/sandbox/web-components-playground-forked-9wzg2x

AndreeaMoise commented 2 weeks ago

@rajithaeyee thanks for the help. I was wondering, why is the observer necessary? When I remove the updated, the sandbox still works. So it seems like updating the modelValue with the textarea value suffices it.

rajithaeyee commented 2 weeks ago

@AndreeaMoise glad you find it useful, and yeah probably it works without updated because i tried few different workarounds there in the sandbox and might forgot to clean the code 😅. However,the reason to add observer was that the observer ensures that any internal mutations to the <textarea> are reflected in lionTextarea.modelValue. 🙌

AndreeaMoise commented 2 weeks ago

Alright, clear!