You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Affected Version: v2 (didn't occur in v1)
Affected Components: Let's take the ui5-input as example, but it applies to all other form components as well
Used Framework: React & UI5-WCR
Bug 1: Submit Event Triggered Too Soon
When the user presses Enter, the submit event is triggered immediately. However, other events aren't triggered beforehand, most prominently the change event isn't triggered before the submit event.
Just to be clear: It works when you click the submit button manually, because you leave the field by clicking the button and thereby trigger the change event. So this bug really only occurs when "Enter" is pressed via keyboard or send via mobile scanner device when stuff is scanned.
This is required, however, to implement any form validation solution. Using the change event was a workable and general way for us to hook our validation solution into UI5-WC, which doesn't work anymore. This bug makes it hard to use any validation framework; we are using react-hook-form, for example.
Our workaround attempts are based to turn off that submit behavior.
Bug 2: The Enter-Behavior Should Be Opt-In
While it's kind of best practice to use Enter as form submit, this doesn't hold true for all use cases.
We, for example, often want to use Enter as way to focus the next input field instead of submitting the whole form.
Example: Mobile scanner device: you scan a QR code value into one field and the device also adds an emulated Enter. Because you might need to scan multiple things (eg. product and batch) we want to focus the next field, so that the workflow of the employee won't get interrupted.
Hence, it would be cool to consciously opt-in to the submit behavior.
Affected Component
All Form Inputs
Expected Behaviour
Change and other events are triggered before submit
Behavior of Enter within input fields needs to be customizable (or at least opt-in to submit behavior)
Hello @SAP/ui5-webcomponents-topic-rl , please have a look at this issue.
When ui5-input is placed in form, upon pressing Enter "submit" event is fired before the "change" event of ui5-input, while with native input the order of events is reversed.
Thanks for the remarks!
I've considered it to be onkeyup but holding enter keeps on firing submit event on the native input.
Thats why we decided to keep it on the keydown.
You're talking about implementation details, however the requirements for and consequences of any implementation are essential.
And here I would like to ask: Would you agree that the requirements / problems I've named are relevant?
change must be triggered before submit (actually the complete event chain must be respected)
we need a way to prevent the form submit
If so, then you should solve these issues or, if you can't (worst case scenario), drop the feature altogether.
If this feature had been implemented as opt-in instead of being the default behavior from the get go, it wouldn't be a breaking change. Also, while this behavior is in line with standard HTML forms (not completely, you need to a add a form tag at least), SAPUI5 behaves differently.
Bug Description
Affected Version: v2 (didn't occur in v1)
Affected Components: Let's take the
ui5-input
as example, but it applies to all other form components as wellUsed Framework: React & UI5-WCR
Bug 1: Submit Event Triggered Too Soon
When the user presses
Enter
, thesubmit
event is triggered immediately. However, other events aren't triggered beforehand, most prominently thechange
event isn't triggered before thesubmit
event.Just to be clear: It works when you click the submit button manually, because you leave the field by clicking the button and thereby trigger the change event. So this bug really only occurs when "Enter" is pressed via keyboard or send via mobile scanner device when stuff is scanned.
This is required, however, to implement any form validation solution. Using the
change
event was a workable and general way for us to hook our validation solution into UI5-WC, which doesn't work anymore. This bug makes it hard to use any validation framework; we are using react-hook-form, for example.Our workaround attempts are based to turn off that submit behavior.
Bug 2: The Enter-Behavior Should Be Opt-In
While it's kind of best practice to use
Enter
as form submit, this doesn't hold true for all use cases.We, for example, often want to use
Enter
as way to focus the next input field instead of submitting the whole form.Example: Mobile scanner device: you scan a QR code value into one field and the device also adds an emulated
Enter
. Because you might need to scan multiple things (eg. product and batch) we want to focus the next field, so that the workflow of the employee won't get interrupted.Hence, it would be cool to consciously opt-in to the submit behavior.
Affected Component
All Form Inputs
Expected Behaviour
Change
and other events are triggered beforesubmit
Enter
within input fields needs to be customizable (or at least opt-in to submit behavior)Isolated Example
https://stackblitz.com/edit/js-ozhtujoe?file=index.js
Steps to Reproduce
Log Output, Stack Trace or Screenshots
No response
Priority
High
UI5 Web Components Version
2.6.2, but probably 2.x
Browser
Chrome, Firefox, Safari, Edge
Operating System
Windows
Additional Context
No response
Organization
No response
Declaration
The text was updated successfully, but these errors were encountered: