Preact: Preact/compat - Input maxLength of null should be equal to undefined

Created on 4 Aug 2020  路  4Comments  路  Source: preactjs/preact

Reproduction

Steps to reproduce

Type "anything" in the email input.

Expected Behavior

Can type "anything" since maxLength is not enforced. Inspecting the input element shows a value of "anything" and the maxLength attribute is not there.

Actual Behavior

Can't type "anything" since maxLength is enforced. Inspecting the input does not show a value of "anything" and the maxLength attribute is equal "0".

beginner-friendly bug compat

All 4 comments

Thanks for the report. I guess this is something to be added to the vnode normalization here: https://github.com/preactjs/preact/blob/master/compat/src/render.js#L142

Since this seems to be a beginner friendly issue I'll flag it as such and will wait a bit to see whether somebody wants to tackle it.

The codesandbox is using old versions of Preact, but it does look like we are failing to convert null to undefined here. This can be fixed in core.

Note that this only affects maxLength={null} - maxLength={undefined} works properly.

I updated the sandbox to use latest Preact version. This issue is not affecting our team at the moment since we got stuck a few months ago with other issues on our transition to use preact/compat but I might tackle it by end of week if not one jumps on it. Do we want this to be fix in core or compat? @developit

That would be cool! I guess core should be fine.

Sad to hear about the issues, are we talking about preact bugs/incompatibilities?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcosguti picture marcosguti  路  3Comments

skaraman picture skaraman  路  3Comments

rajaraodv picture rajaraodv  路  3Comments

paulkatich picture paulkatich  路  3Comments

matthewmueller picture matthewmueller  路  3Comments