webscopeio / react-textarea-autocomplete

📝 React component implements configurable GitHub's like textarea autocomplete.
MIT License
454 stars 80 forks source link

support Shadow DOM #221

Closed twrichards closed 3 years ago

twrichards commented 3 years ago

I was running into problems where it couldn't retrieve the target from the event in the internal _changeHandler when this library is being used in the Shadow DOM.

This PR adds a fallback when obtaining the textarea in the _changeHandler, to use the textAreaRef (which should already be populated) if the event.target is undefined/null.

I also make sure the target property on the event passed to the onChange (provided by the consumer of the library) makes use of this more robust textarea variable.

image

twrichards commented 3 years ago

hey @jukben - although the e2e cypress tests are timing out at the moment - is there any chance I could get a provisional review of this PR please?

twrichards commented 3 years ago

hey @jukben - the cypress tests are now all passing - please could I get a cheeky review? (and all being well, a release) 🙏

jukben commented 3 years ago

Released in 4.8