1

we have the problem that a transition from the SAP Fiori Launchpad into our application sets the focus on the SearchField of the Master view.

UI5 SearchField

It's a problem, because on mobile devices it triggers the activation of the keyboard which blocks the list view entries.

Any idea how to prevent that behaviour?

Directly entering the application is not creating this problem.

It's also happening in another Master/Detail application we created.

Across Android and iOS devices, replicated on Safari, Chrome, and Firefox.

Kind regards,

Michael

Michael K.
  • 535
  • 6
  • 21
  • Can you provide the code which triggers the transition from the Launchpad to your Application? – Tim Gerlach May 04 '15 at 14:06
  • Hi Tim. The Launchpad is set up with the Launchpad Designer and a huge pack of SAP transactions, in a very complex process. How SAP is making the connections between a click on a Launchpad tile and the application is completely out of my hands. Therefore I can't provide any code, it's a SAP thing. But I was told that the sapui5 tag would be the official SAP dev channel, hence I hope they see my question. – Michael K. May 04 '15 at 15:20
  • I've not seen the above mentioned behavior being the developer of many master-detail pattern apps. What's the SAPUI5 version? And the name of SAP delivered app? – Sunil B N May 04 '15 at 18:11
  • UI5 version is 1.26.9 and I'm talking about the SAP Fiori Launchpad http://help.sap.com/saphelp_uiaddon10/helpdata/en/f9/51b50a07ce41deb08ced62711fe8b5/frameset.htm – Michael K. May 05 '15 at 06:24
  • @Deftoned I wanted to know the app in which Search Box is getting focused.. Something like Leave Request/Approval/Sales Order. Application Name – Sunil B N May 05 '15 at 11:12
  • @SunilBN It's our own application, based on an older Sales Order example. – Michael K. May 05 '15 at 11:59
  • I'm redirecting future readers to a newer Q&A. Unlike in the past, the FLP should by now set the focus to the shell header title. If not, the only option is to explicitly set the focus somewhere else in the application which the linked Q&A explains how. – Boghyon Hoffmann Mar 11 '23 at 14:33

2 Answers2

1

A bit late to the party but we had the same problem. Using onAfterRendering does work only once because that lifecycle hook gets only called once. To solve the issue do the following:

onInit: function () {
    // onAfterShow hook gets called every time the view is shown
    this.getView().addEventDelegate({onAfterShow: this._afterShow}, this);
},

_afterShow: function () {
    jQuery.sap.delayedCall(0, this, function () {
        jQuery('input').blur();
    });
}

Hope that helps.

z00bs
  • 7,518
  • 4
  • 34
  • 53
0

This is a workaround (the easiest solution I could Find as of now) since I couldn't reproduce your issue :(

onDataLoaded() or in onAfterRedering() methods

//basically set the focus on something like this.. OR just create any SAPUI5 element and setVisible(false) and set the focus()

this.getList().focus();

UPDATE: Catch hold of search in getHeaderFooterOptions()

getHeaderFooterOptions: function () {
    var _this = this;
    var objHdrFtr = {
       //sI18NMasterTitle: "YOUR_TITLE",
        onRefresh: function (searchField, fnRefreshCompleted) {
            _this._searchField = searchField;
        }
    };
    return objHdrFtr;
}

then

onAfterRendering(){
 if(this._searchField){
 this._searchField.onAfterRendering = function() {
            jQuery(this.getDomRef()).focusout()
        };
    }
}

Let me know if this works or not! I will delete the answer.

Sunil B N
  • 4,159
  • 1
  • 31
  • 52