You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an issue on inserting an HTML <input type="text" /> in a foreignObject: the HTML input doesn't take focus.
I guess the plugin listeners are having precedence over the input's one...
Any advice to resolve this?
Thank you.
The text was updated successfully, but these errors were encountered:
Mh, that's a tough one. Ofc the default behavior needs to be prevented so that the browser is not scrolling or zooming.
I don't see a simple solution to that problem right now. You could try and listen to touchstart and touchend on the input yourself and focus it yourself maybe?
// Get the foreignElement's input (here the input is wrapped in a <div>)constinput: HTMLInputElement=foreignElement.node.getElementsByTagName('input')[0];// The listener for 'click outside'constonClickOutside=(event: MouseEvent)=>{if(event.target===input){returnfalse;}// Blur the inner input element.input.blur();// Remove the listener on windowwindow.removeEventListener('mousedown',onClickOutside);};// Add listener to mousedown eventinput.addEventListener('mousedown',()=>{input.focus();// Add listener to 'click outside' eventwindow.addEventListener('mousedown',onClickOutside);});
Hello and thank you for this work!
I have an issue on inserting an HTML
<input type="text" />
in aforeignObject
: the HTML input doesn't take focus.I guess the plugin listeners are having precedence over the input's one...
Any advice to resolve this?
Thank you.
The text was updated successfully, but these errors were encountered: