0

I'm creating a customselect form control and when it has a state disabled I need to skip focusin and focusout events.

This code without disabled validation doesn't work, the focusin is still emited.

@Element() private element: HTMLElement;

public componentWillLoad() {
  this.element.addEventListener('focusin', (e) => {
    e.preventDefault();
    e.stopPropagation();
  });
}
Daniel Delgado
  • 4,813
  • 5
  • 40
  • 48
  • `this.element` will not be defined until after the component loaded. Does it work in `componentDidLoad()`? – Thomas Mar 27 '20 at 14:06
  • Afaik the element reference should already exist in `componentWillLoad` as well. Where in the DOM does the element live that causes the event? – Simon Hänisch Mar 27 '20 at 15:39
  • (see https://webcomponents.dev/edit/8VsXghnUPUvjwvu0vL11?pm=1, the element is already defined in `componentWillLoad`) – Simon Hänisch Mar 27 '20 at 15:40

0 Answers0