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

FloatLabel: The label appears outside the box #6450

Closed
CosmeValera opened this issue Apr 22, 2024 · 2 comments
Closed

FloatLabel: The label appears outside the box #6450

CosmeValera opened this issue Apr 22, 2024 · 2 comments
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team

Comments

@CosmeValera
Copy link
Contributor

Describe the bug

I have the latest Prime React dependency installed, I'm using the new component FloatLabel, but the placeholder is appeearing outside the box.

Images:

image
image

Code:

image
FloatLabel docu

The error:

image

Reproducer

No response

PrimeReact version

10.6.3

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

Chrome

Steps to reproduce the behavior

Use the code as put in the documentation and it won't work

Expected behavior

https://primereact.org/floatlabel/

@CosmeValera CosmeValera added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 22, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. Status: In Progress Core Team is working on the issue or pull request and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Apr 22, 2024
@melloware melloware added this to the 10.6.4 milestone Apr 22, 2024
@Rekl0w
Copy link
Contributor

Rekl0w commented Apr 22, 2024

I guess #6440 will solve this problem

@CosmeValera
Copy link
Contributor Author

CosmeValera commented Apr 23, 2024

I just realised it was another css file that was colliding with the styles of FloatLabel.

In this case I had this:
image

Which was making the span.float-label be centered, but it has no effect on the label, thus creating that strange effect:
image
With inspector
image

I guess that using css files, instead of the theme will cause this type of problems, so it is not guaranteed for bugs like this not to appear when people use custom css like in my case.

Anyway, I've been investigating, and I noticed that the problem happens because both the span (container) and the label have position: relative, therefore label does not depend on the position of span, but on the position of the outer container. This could be fixed making the span that contains the input and the label have position: absolute.

I'm not sure if this behaviour is considered a feature or a bug.

@melloware melloware added Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team and removed Type: Bug Issue contains a defect related to a specific component. Status: In Progress Core Team is working on the issue or pull request labels Apr 23, 2024
@melloware melloware removed this from the 10.6.4 milestone Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team
Projects
None yet
Development

No branches or pull requests

3 participants