sap.m.SearchField on iOS phone will not show keyboard when suggestions enabled
OpenUI5 version: 1.48.12
Browser/version (+device/version): Safari iOS 11
Any other tested browsers/devices(OK/FAIL): No other tested browser
Steps to reproduce the problem:
- Render a page with the
tag and set enableSuggestions to true - Display page on iOS Safari
- Try and type in search field. No keyboard
What is the expected result? Keyboard to allow text search
What happens instead? No keyboard displayed
Any other information? (attach screenshot if possible) The code in SearchFieldRenderer.js has this at line 103
if (oSF.getEnableSuggestions() && Device.system.phone) {
// Always open a dialog on a phone if suggestions are on.
// To avoid soft keyboard flickering, set the readonly attribute.
rm.writeAttribute("readonly", "readonly");
}
It sets the HTML Input Tag readonly attribute to "readonly". iOS 11 on Safari will not pop up a keyboard if this is set.
@DeanDavis please test if you see the keyboard with this example - https://openui5.hana.ondemand.com/#/sample/sap.m.sample.SearchFieldSuggestions/preview Note that the focus is on the suggestions when they are shown, and typing in the input pops the keyboard of the device. I tested with Chrome/Android 6 and Safari/iOS 11
Yes I did that. And I think I know the difference. The online example binds a model to the suggestionItems aggregation. So when you click into the field you immediately go into a dialog where all the suggestion items are displayed and the SearchField is re-rendered inside the dialog (a little UI trickery) and the keyboard will work because the new SearchField isn't readonly.
This is what the SearchField input tag looks like inside the dialog
<input type="search" autocomplete="off" autocorrect="off" id="__field0-I" class="sapMSFI" placeholder="Search">
But in my app I have nothing bound to suggestionItems initially. I'm using the 'suggest' event to call a function. In that function I see what the value is. If it is less than 3 characters then I do nothing, offer no suggestion items. Once I get to 3 characters or more then I search my array of possible suggestions for matches and create sap.m.SuggestionsItems and add them one at a time to the SearchField aggregation in code.
So, think, because I don't immediately go into the dialog, my search input element gets focus but I don't get a keyboard.
@DeanDavis Please extend this example to illustrate the settings which reproduce the problem - https://jsbin.com/modopamiyu/edit?html,output Thanks
Use this link on an iPhone. https://output.jsbin.com/woqetev/ Demonstrates the problem.
The way I programmed it the dummy suggestion items would appear after entering 3 or more characters in the search bar. Works on browser and iPad but not iPhone.
Hi, The way suggestions are not shown seems to be related to the problem, and it is reproducible on iPhone and Samsung mobile devices in my test. The case is forwarded to colleagues for further investigation with ticket #1780416030 Updates will be posted here as well.
Hi,
The sap.m.SearchField doesn't support minimum length of the entered text, before suggestions are opened. You cannot use a code like:
if (sv.length > 2) {
this.oSF.suggest();
}
this.oSF.suggest(); must be always called in the 'suggest' event handler.
Only sap.m.Input support such scenarios with input.startSuggestion property.
Best, Teo
There are many valid situations from a performance perspective when we would not like return to source until we have enough data to produce a meaningful list. It's disappointing that this isn't catered for. I assume the recommendation is to not use search field in these scenarios (even though we are searching) or to return an "keep on typing for more results" entry? Or just return 0 results but keep on suggesting?