Skip to content

Issues with onDbChange and custom event #1061

Open
@pschaub

Description

@pschaub

The DbInput component has a custom dbChange prop that emits a custom event when the value of the input is changed.

This custom prop with a custom event goes against the standard HTML behavior, which uses the onChange prop with a standardized event for this purpose.

I would like to suggest that the DbInput component and any other component that has the same custom behaviour should be modified to provide the standard onChange prop instead of the custom dbChange prop. This would make it easier to use the component in conjunction with other React libraries (e.g. react-hook-form) and avoid the need for custom event handling.

Alternatively, if the dbChange prop must be used for some specific reason, it would be helpful if the dbChange prop would emit the standard onChange event instead of a new custom event.

As a workaround, I had to create a custom adapter function that transforms the dbChange custom event into a standard onChange event, as shown in this code example: https://codesandbox.io/s/db-ui-elements-ondbchange-5rjslj

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions