Posted 14 August 2018, 7:52 am EST
I want to apply some styling to the parent wj-input-date / wj-input-time elements when their input is focused. Since IE and Edge don’t support :focus-within, I’m trying to do it programmatically, but I’m not sure how to add it to the element. Here’s what I have so far:
component.html
<wj-input-date #startDate (initialized)="initDateTime(startDate)" [(value)]="data.startDate"></wj-input-date> <wj-input-time #startTime (initialized)="initDateTime(startTime)" [(value)]="data.startDate"></wj-input-time>
component.css
.picker-focused { outline: none; box-shadow: 0 0 0 2px #FF0000; }
component.ts
initDateTime (control: WjInputDate | WjInputTime) { control.gotFocus.addHandler(() => { // add .picker-focused here }) control.lostFocus.addHandler(() => { // remove .picker-focused here }) }
How do I make this work? Or am I going about it wrong, and there’s a better way to apply the style on focus?