3

Is it possible to propagate a focus() call on the html element of a web-component to its children (input)?

The web-component contains an input:

render() {
return (
  <Host>
    <div>
      <input
       ...
      />
    </div>
  </Host>
);

}

I tried to call focus() on the web-component itself and to find the input element in the shadowdom and call focus() there but it didn't work. Is it not possible to focus an element inside shadow-dom?

maidi
  • 3,219
  • 6
  • 27
  • 55
  • You could add a method in component that will focus on input element. Alternatively an event that will do the same thing. – Lukas C Sep 20 '20 at 19:17

0 Answers0