on 2021 Jul 06 12:52 PM
Hi there,
I have recently encountered a SAPUI5 behavior which I cannot tell if it is a bug or a feature :-).
I'm working on an app that is built with SAPUI5 v1.52, and, for the sake of simplicity, has 2 fields: a sap.m.SearchField and a sap.m.Input.
Upon selecting a suggestion of the SearchField, the Input is set to 1 and the focus is changed from the SearchField to the Input.
With the Input field in focus, the user has the possibility of modifying the Input and then switch back to the SearchField by pressing the Enter key. This is done by handling the submit event of the Input and moving the focus from the Input to the SearchField.
The strange part about this workflow is that upon switching the focus from the Input to the SearchField, the entire page is refreshed.
A short example can be found here: https://plnkr.co/plunk/dVGQPSh2MaAmF5Yw
After looking through the SAPUI5 docu, I stumbled upon the Side Effects topic which seems to be somewhat related to the use case I described.
So the question is: bug or feature :-)?
Request clarification before answering.
Update: the issue is no longer reproducible due to the fix (commit: 491f3c6) available as of UI5 1.94.
Original answer: Definitely a bug. Here is an mcve: https://jsbin.com/qicayen/edit?js,output (Feel free to use that bin for reporting issue on GitHub). Not sure if UI5 could do anything about it though.
A quick fix would be to call the focus() asynchronously right after the last call stack has been processed:
setTimeout(() => this.byId("thatTargetControl").focus());
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Boghyon,
Thanks for the hint! It did solve my problem and I will also post a bug on github.
Have a good day!
Sergiu
User | Count |
---|---|
96 | |
11 | |
9 | |
9 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.