i18n: Upgrade translations from crowdin (253f51dd). (docs)
[ProtonMail-WebClient.git] / packages / chargebee / src / ui-utils.ts
blob0a2311a62fbeac52f4afcbfe0ed75198a4d2529d
1 // :has() selector doesn't work in Firefox, so need to use JS to add/remove class
2 export function trackFocus(selector: string, cbElement: any) {
3     const element = document.querySelector(selector);
4     if (!element) {
5         throw new Error(`Element with selector ${selector} not found`);
6     }
8     cbElement.on('focus', () => {
9         element.closest('.card-input--one-line')?.classList.add('focus');
10     });
12     cbElement.on('blur', () => {
13         element.closest('.card-input--one-line')?.classList.remove('focus');
14     });