-
-
Notifications
You must be signed in to change notification settings - Fork 45
Prevent Combobox dropdown list dismissal during text changed event #3452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent Combobox dropdown list dismissal during text changed event #3452
Conversation
📝 WalkthroughWalkthroughThe PR modifies Estimated code review effort🎯 2 (Simple) | ⏱️ ~5–10 minutes
Areas to verify:
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
app/src/org/commcare/views/widgets/ComboboxWidget.java (2)
32-32: Consider adding a documentation comment for clarity.While the flag name is descriptive, a brief comment explaining its purpose would help future maintainers understand why this flag exists and how it's used to control dropdown behavior during text input.
For example:
+ // Tracks whether widgetEntryChanged() was called from afterTextChanged() to prevent + // dropdown dismissal during active typing private boolean wasWidgetChangedOnTextChanged = false;
124-126: LGTM! Logic correctly prevents dropdown dismissal during text input.The conditional dismissal ensures the dropdown remains visible while users are actively typing (allowing them to see filtered results), while still dismissing appropriately when items are selected or focus is lost.
Minor style note: Consider adding a space after
iffor consistency with Java conventions:- if(!wasWidgetChangedOnTextChanged) { + if (!wasWidgetChangedOnTextChanged) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/src/org/commcare/views/widgets/ComboboxWidget.java(3 hunks)
🔇 Additional comments (1)
app/src/org/commcare/views/widgets/ComboboxWidget.java (1)
99-104: LGTM! Proper use of try-finally for flag management.The try-finally pattern correctly ensures that
wasWidgetChangedOnTextChangedis always reset to false afterwidgetEntryChanged()completes, even if an exception is thrown. This prevents the flag from being left in an incorrect state.
shubham1g5
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see it in video attached clearly but can you confirm that the dropdown gets dismissed correctly when user clicks on an option inside dropdown ?
Yes, it does. |
|
@avazirna can we link the Jira ticket please to this. |
Product Description
This addresses an issue introduced by #3445. QA reported that when users manually delete the selected item in the ComboboxWidget, the dropdown list is dismissed, preventing users from seeing the filtered items (see video below).
comboboxwidget_dropdown_list_issue.webm
comboboxwidget_dropdown_list_issue_fix.webm
Ticket: https://dimagi.atlassian.net/browse/QA-8262
Technical Summary
The issue occurs because widgetEntryChanged() calls getAnswer(), and within the
ComboboxWidget, this method dismisses the dropdown list. The solution here was to prevent the dismissal when thewidgetEntryChanged()is called during anafterTextChanged()event.Safety Assurance
Safety story
Successfully tested locally.
QA Plan
QA will retest this fix to confirm that the issue has been resolved.
Labels and Review