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

bug: Custom CSS Properties Not Applying to ion-input with "fill" Attribute #29138

Closed
3 tasks done
MustafaBaban opened this issue Mar 12, 2024 · 7 comments
Closed
3 tasks done
Assignees
Labels
needs: reply the issue needs a response from the user

Comments

@MustafaBaban
Copy link

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

I've encountered an issue where several custom CSS properties do not seem to affect the ion-input component as expected when its fill attribute is set to either solid or outline. The specific custom properties in question are --border-radius, --padding-start, --padding-end, and --background (background for solid only). Despite setting these properties in my CSS, the ion-input component does not reflect the corresponding changes.

Expected Behavior

The ion-input component should correctly apply the styles defined by the custom CSS properties --border-radius, --padding-start, --padding-end, and --background, reflecting changes in border radius, padding, and background color accordingly.

Steps to Reproduce

  1. Add an ion-input element to a page with the fill attribute set to either solid or outline.

  2. Apply custom CSS properties to the ion-input element, such as --border-radius, --padding-start, --padding-end, and --background.

  3. Observe that the ion-input does not display the expected styles defined by these custom properties.

Code Reproduction URL

https://stackblitz.com/edit/azzuud

Ionic Info

7.x on stackblitz

Additional Information

No response

@MustafaBaban
Copy link
Author

I plan on creating a pull request for this Issue

@sean-perkins
Copy link
Contributor

Hello @MustafaBaban thanks for this issue.

The problem you are experiencing is related to CSS specificity. The Ionic Framework implementation applies the styles to an .input-fill-solid class that has a higher specificity than your .custom-input class.

Applying a more specific selector, such as:

.custom-input.md {

will result in the styles applying as expected.

@MustafaBaban
Copy link
Author

MustafaBaban commented Mar 12, 2024

Thank you for your quick answer and guidance on the CSS specificity issue

While your suggestion is valid, it requires an additional class not mentioned in the documentation.

To maintain consistency with the Ionic documentation and improve developer experience, may I propose submitting a PR myself to address this?

I believe a slight adjustment could help others facing the same issue, ensuring styles apply as expected without extra specificity. Would that be ok?

@sean-perkins
Copy link
Contributor

@MustafaBaban could you share what your suggestion for a PR would include? I want to make sure you aren't investing time into a path we may not accept.

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Mar 15, 2024
@ionitron-bot ionitron-bot bot removed the triage label Mar 15, 2024
@MustafaBaban
Copy link
Author

Hey @sean-perkins,

It looks like I won't be able to get to that PR. Really sorry about that. I was looking forward to contributing, but it seems like it's not in the cards right now.

I'm still hoping the issue with the ion-input fill custom CSS properties gets some attention. Just won't be able to tackle it myself at the moment. Sorry <3

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Mar 16, 2024
@sean-perkins
Copy link
Contributor

@MustafaBaban can you share what your suggestions would have been? At this time I do not believe this to be a bug with Ionic Framework and plan to close as a result.

CSS specificity is expected when targeting element selectors that Ionic Framework internally styles.

@sean-perkins sean-perkins added the needs: reply the issue needs a response from the user label Mar 21, 2024
@sean-perkins sean-perkins assigned sean-perkins and unassigned thetaPC Mar 21, 2024
@ionitron-bot ionitron-bot bot removed the triage label Mar 21, 2024
Copy link

ionitron-bot bot commented Apr 4, 2024

Thanks for the issue! This issue is being closed due to the lack of a reply. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Thank you for using Ionic!

@ionitron-bot ionitron-bot bot closed this as completed Apr 4, 2024
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Apr 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: reply the issue needs a response from the user
Projects
None yet
Development

No branches or pull requests

4 participants