-
-
Notifications
You must be signed in to change notification settings - Fork 189
Fixed styling for input (regular and money) #920
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
base: main
Are you sure you want to change the base?
Conversation
@AtmoFX I can't reproduce it The "issue" here maybe is because the input/money component won't place |
Hey @robsontenorio, I would like to double down on my analysis though. TBH, I don't even see an attempt at reproducing the issues from the PR in your screenshot, since you have not copied my code nor tried to add any Maybe you could try to do that and let me know? If you prefer going through the long technical explanation, here it is: With the snippet you posted, most likely, only 1 of the issues I mentioned will be visible and it won't be so obvious if you don't know what to look for. To see it:
From what I see What the switch between the default cursor and the forbidden cursor reveals is that the actual input field lies strictly inside the "visual" input field, with margins or padding on all 4 sides: i.e. the screen area covered by the input does not match what the user will interpret as the input. Now, let us get into the analysis of what is going on. The easiest way to understand is most likely to add a fake CSS class and see where it lands inside the rendered HTML:
becomes (after removing the extra line breaks and
The Armed with the above knowledge, we can infer there will be 2 types of CSS properties in the context of elements that occupy different areas on screen:
There is also the case of properties that do not matter here, such as text color or font size: since the inner |
I am still figuring out how we can address this case, as it is really challenging to cover all the edge cases with customizations. |
Yes, you'd need to be more specific if you need my help for that but I know what you mean. It's the same for me with #901. |
If you confirm you dislike my way of keeping the Additionally and independently from the above, do you think it would be possible to customize the way tailwind classes are merged together? What is done right now would remain as the default but we could for instance set another one in The downside to that approach is of course that every component needs to be changed accordingly. Likely not a small endeavour. |
When trying to enforce CSS classes to inputs (you will find a snippet below), intending to render
disabled
orreadonly
inputs like normal, this is what I get:There are 2 issues, the first of which being about the cursor (not captured on the screenshot):
forbidden
, as per the following 2 rules:money
inputs have an extradiv
right aboveinput
in the DOM, so the cursor is only correct on the outside perimeter of what looks like theinput
(but is actually thelabel
). The screenshot makes the area where the cursor is incorrect visible thanks to the inner borders but that would not be the case for the unstyled control (i.e. what users currently get) in the left column.It turns out that
div
is unnecessary, granted the money-specific code is moved to thelabel
.class
to inputs causes them to appear on both thelabel
and on theinput
. That is what creates the 2 borders in the screenshot.By not merging the
class
attribute on theinput
, this effect disappears and the inputs can be styled with!important
classes.This is the same code after the changes are applied to
Input
.