From 565747357321bf6b1a9156f4ace458b0071d602d Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Thu, 16 May 2024 09:16:02 +0530 Subject: [PATCH] fix: Dashboard phone number input country `undefined` in `onSelectCountry` (#9473) # Pull Request Template ## Description This PR will fix this sentry [issue](https://chatwoot-p3.sentry.io/issues/5291039795/) **Issue** The root cause of this issue is the usage of `keyboardEventListenerMixins`. The key events are always active when the edit conversation modal is active, even if the country dropdown is not visible. So, if we press the enter key, this error will be thrown into the console. **Solution** Remove the use of `keyboardEventListenerMixins` and handle it directly in the Vue native key events. Also, always check if the dropdown is active. **Other changes** 1. Remove the `mouseup` event lister and use the click away directive. 2. Use inline Tailwind css Fixes https://linear.app/chatwoot/issue/CW-3282/phonenumberinput-country-undefined-in-onselectcountry ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? **Steps** 1. Open a conversation. 3. And click the edit contact button 4. And click the enter key 5. Now you can see the error in the console ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --- .../components/widgets/forms/PhoneInput.vue | 176 ++++++------------ 1 file changed, 62 insertions(+), 114 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/forms/PhoneInput.vue b/app/javascript/dashboard/components/widgets/forms/PhoneInput.vue index 9b77faafe..6b09acbac 100644 --- a/app/javascript/dashboard/components/widgets/forms/PhoneInput.vue +++ b/app/javascript/dashboard/components/widgets/forms/PhoneInput.vue @@ -1,9 +1,16 @@