Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputText inherits size from HTMLInputElement and size is number #5283

Closed
Dalorzo opened this issue Nov 10, 2023 · 3 comments · Fixed by #5284
Closed

InputText inherits size from HTMLInputElement and size is number #5283

Dalorzo opened this issue Nov 10, 2023 · 3 comments · Fixed by #5284
Assignees
Labels
Typescript Issue or pull request is *only* related to TypeScript definition
Milestone

Comments

@Dalorzo
Copy link
Contributor

Dalorzo commented Nov 10, 2023

Describe the bug

The HTMLInputElement interface provides special properties and methods for manipulating the options, layout, and presentation of <input> elements.
Supported by:
Chrome, Chrome Android, Edge, Firefox, Opera 8, Safari, Safari iOS
By Mozilla Contributors , CC BY-SA 2.5 

https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement
***size: unsigned long:***

However, it is used by primereact as a string :

{
 'text-lg px-4 py-4': props.size == 'large',
 'text-xs px-2 py-2': props.size == 'small',
 'p-3 text-base': props.size == null
}

Reproducer

No response

PrimeReact version

10.0.9

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to https://primereact.org/inputtext/
  2. Under tab theming

Expected behavior

From my POV this seems a violation of the Solid principle of Liskov Substitution Principle or Composition over inheritance.

@Dalorzo Dalorzo added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 10, 2023
@melloware
Copy link
Member

I don't understand your issue?

@Dalorzo
Copy link
Contributor Author

Dalorzo commented Nov 10, 2023

@melloware thanks for looking into this. Allow me to elaborate, the size property is of type number, it is not a string.

image

InputHTML the property size is number. However, it is being used as it if it were a string e.x. props.size == 'large'

Please do not hesitate to reach out if you need additional details or if you would like to discuss the issue further

@melloware melloware added Typescript Issue or pull request is *only* related to TypeScript definition and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 10, 2023
@melloware melloware self-assigned this Nov 10, 2023
@melloware melloware added this to the 10.0.10 milestone Nov 10, 2023
melloware added a commit to melloware/primereact that referenced this issue Nov 10, 2023
melloware added a commit to melloware/primereact that referenced this issue Nov 10, 2023
@melloware
Copy link
Member

Got it. Easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typescript Issue or pull request is *only* related to TypeScript definition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants