SAP / ui5-webcomponents

UI5 Web Components - the enterprise-flavored sugar on top of native APIs! Build SAP Fiori user interfaces with the technology of your choice.
https://sap.github.io/ui5-webcomponents/
Apache License 2.0
1.5k stars 260 forks source link

[form|ui5-input] cannot trigger onInput when use browser autofill #9356

Closed InfiniteXyy closed 2 months ago

InfiniteXyy commented 2 months ago

Bug Description

onInput/onChange is not triggered when using browser autofill to fill an InputField, and an error was throwed TypeError: Cannot read properties of undefined (reading 'inputType')

I found this nullPointer issue could be easier solved by adding a non-empty check, and I think it won't cause any side effects.

(This e.detail is undefined when using autocomplete)

https://github.com/SAP/ui5-webcomponents/blob/54944a8455be0cd2e6c4c9255887eaa3d5954717/packages/main/src/Input.ts#L1010-L1015

BTW: There is already an issue about this behaviour, https://github.com/SAP/ui5-webcomponents/issues/8706 and it was closed by removing the autocompletion feature out.

But I personally think that having the autocomplete feature can greatly enhance the user experience and don't want to kill it.

Affected Component

No response

Expected Behaviour

The onInput should work when using browser autocomplete

Isolated Example

https://github.com/InfiniteXyy/ui5-input-bug-reproduce

Steps to Reproduce

  1. clone https://github.com/InfiniteXyy/ui5-input-bug-reproduce
  2. run yarn && yarn dev
  3. try using browser autocomplete to fill the blanks (the form shouldn't be updated)
  4. run yarn patch && yarn dev
  5. try using browser autocomplete to fill the blanks (the form should be updated)

Log Output, Stack Trace or Screenshots

image

Priority

None

UI5 Web Components Version

1.24.6

Browser

Chrome, Safari

Operating System

macOS 14.5

Additional Context

I am using @ui5/webcomponents-react to reproduce the issue., This library is just a wrapper for web components, and the bugs encountered are all the same.

Organization

No response

Declaration

nikoletavnv commented 2 months ago

Hello @InfiniteXyy,

The reason the browser suggestions are turned off is to follows the design specs - the input to compete its value from the input suggestions and value state popovers. This is done via autocomplete="off" set on the native input.

This issue has been discussed and for now the solution is to disable the autocomplete for the native input. Disabling of the autocomplete will be available in a future version patch of the web components, so there won't be this console error.

Kind regards, Nikoleta Terzieva