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

How to style pseudo classes for the Adyen input fields #2677

Open
ashrafnazar opened this issue May 8, 2024 · 17 comments
Open

How to style pseudo classes for the Adyen input fields #2677

ashrafnazar opened this issue May 8, 2024 · 17 comments
Labels
Enhancement New feature or request Needs more info Further information is requested

Comments

@ashrafnazar
Copy link

Is your feature request related to a problem? Please describe.
I would like to be able to style a pseudo class in :focus, for the input fields in the AdyenCheckout instance.

Describe the solution you'd like
A way to style pseudo classes, so potentially an onFocus property in the CoreOptions interface or a way to do the same thing inside the styles object, as part of the PaymentMethodOptions generic type.

Describe alternatives you've considered
I've attempted to use the second argument (element) inside the onChange property within the CoreOptions interface, but have not found a way to do so.

Additional context
N/A

@ashrafnazar ashrafnazar added the Enhancement New feature or request label May 8, 2024
@m1aw
Copy link
Contributor

m1aw commented May 8, 2024

Hello @ashrafnazar

What would be the objective here? I ask because we are going to be rolling out CSS variables in V6 and you will be able to customise it that way.
I wonder however if your use case would be covered. Can you share a few more details on what you are trying to accomplish?

@m1aw m1aw added the Needs more info Further information is requested label May 8, 2024
@ashrafnazar
Copy link
Author

ashrafnazar commented May 8, 2024

Hey @m1aw - it's to match our current designs, so when a user tabs through to an input field, or is on it, then we would like the outline property to change, i.e. its stroke width and colour. Hope that makes sense

@m1aw
Copy link
Contributor

m1aw commented May 8, 2024

Is it currently not possible just by using CSS?

@ashrafnazar
Copy link
Author

ashrafnazar commented May 8, 2024

Hi @m1aw - because the input fields are inside iframes, I don't think it's as simple as updating the CSS. Unless I'm mistaken?

@ashrafnazar
Copy link
Author

ashrafnazar commented May 15, 2024

@m1aw I've been told that I can style the parent element, i.e. the span with the data-cse attribute, but unless I do some sort of hack, there isn't a clean way to update the :focus state of it

@ashrafnazar
Copy link
Author

Do we have any update on this?

@DeekshithShetty
Copy link

Hey @ashrafnazar,

This may not be the best way, but I was able to overwrite Adyen css for the focus state

.adyen-checkout__field--cardNumber:has(.adyen-checkout__label--focused), 
.adyen-checkout__field__exp-date:has(.adyen-checkout__label--focused),
.adyen-checkout__field--expiryDate:has(.adyen-checkout__label--focused),
.adyen-checkout__field__cvc:has(.adyen-checkout__label--focused),
.adyen-checkout__field--securityCode:has(.adyen-checkout__label--focused),
.adyen-checkout__card__holderName:has(.adyen-checkout__label--focused) {
	// your custom css goes here
	background: var(--color-interaction-background-focused);
}

Hope this helps

@ashrafnazar
Copy link
Author

Hi @DeekshithShetty - are you integrating using Adyen's Drop-in component?

@DeekshithShetty
Copy link

@ashrafnazar Yes. I am using the Drop-in component

@ashrafnazar
Copy link
Author

@DeekshithShetty - unfortunately, this won't apply in my case, as my input fields are custom

Copy link
Contributor

github-actions bot commented Oct 2, 2024

This issue is stale because it has been open 30 days with no activity. Please comment on this issue otherwise it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Oct 2, 2024
@ashrafnazar
Copy link
Author

Comment to keep issue open

@github-actions github-actions bot removed the Stale label Oct 3, 2024
@ribeiroguilherme
Copy link
Contributor

@ashrafnazar Are you using create.checkout('securedfields') in this case? Which version of the library are you using?

@ashrafnazar
Copy link
Author

@ribeiroguilherme - I'm using v5 and AdyenCheckout

@ribeiroguilherme
Copy link
Contributor

How are you creating your component? Are you using create.checkout('securedfields') ? And which version of v5 are you using?

@ashrafnazar
Copy link
Author

The version we are using is 5.67.1 and the method is .create('securedfields'…

@sponglord
Copy link
Contributor

@ashrafnazar
Since you are using the "custom card" integration i.e. .create('securedfields'...) how your UI looks, is entirely up to you.

You can set an onFocus callback example here and do whatever you want to style the elements that act as parents for the iframes.

In this example we add/remove a class that controls the border & outline properties of the element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Needs more info Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants