[MGNLUI-361] Search only works when search box loses focus Created: 06/Dec/12  Updated: 11/Feb/13  Resolved: 07/Jan/13

Status: Closed
Project: Magnolia UI
Component/s: content app
Affects Version/s: 5.0
Fix Version/s: 5.0

Type: Bug Priority: Critical
Reporter: Federico Grilli Assignee: Mikaël Geljić
Resolution: Fixed Votes: 0
Labels: framework, frontend
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

This bug seems to happen regularly on security-app and sporadically in other apps.
For some reason, although we actually (visually) switched to the SEARCH view the current view type isn't SEARCH rather TREE hence the following warning when hitting the ENTER key to perform a search. After such warning the code returns w/o executing the search.

WARN  i.admincentral.workbench.ContentWorkbenchPresenter: Expected view type SEARCH but is TREE instead.

Instead, if search box loses focus then the search is performed.



 Comments   
Comment by Federico Grilli [ 06/Dec/12 ]

Did some further investigation. Here's the results.
In the security-app case it looks like the issue has to do with the SearchEvent not fired on the correct SubAppEventBus. In fact, the security-app is made up of four different subapps (well, users and securityUsers subapp temporarily share the same subapp [need to ask Jozef why]) each with its own subapp event bus but it looks like only the first instantiated subApp, namely SecurityUsersSubApp, gets all the search events, even those fired by the other subapps.
I was able to get rid of the warn by removing the line

parentView.setViewType(ViewType.TREE);

in info.magnolia.ui.admincentral.content.view.ContentPresenter.initContentView(ContentWorkbenchView) which apparently is only needed by info.magnolia.ui.admincentral.dialog.ChooseDialogFactoryImpl.createWorkbenchChooseDialog(String) and thus could be set in there.
So by removing that line, search works by hitting ENTER key in the users subapp, still it fails, likely for the above mentioned reasons, in the other subapps.

Comment by Mikaël Geljić [ 04/Jan/13 ]

Searchbox Enter shortcut listener can conflict between multiple workbench sub-apps. This happens there because multiple TextFields (i.e. search boxes) are not in "isolated" Panels (see http://demo.vaadin.com/sampler/#ShortcutScope).

However we don't need the shortcut listener overkill for search. We can simply use a ValueChangeListener instead, with the field set to immediate. The latter ensures value changes are propagated to server immediately when pressing Enter.

Generated at Mon Feb 12 08:36:07 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.