Touch events do not work when <Select />
is mounted in a shadow root
#5824
Labels
issue/bug-unconfirmed
Issues that describe a bug that hasn't been confirmed by a maintainer yet
Hi,
the current approach to touch event handling does not work well when
<Select />
is used with a shadow root.Reproduction
Notes
onTouchEnd
event handler categorizes the touch event as outside the select control (this results in ablurInput()
call).target
, but the entire shadow dom. This is obviously not contained in the original node, which causes the behavior in this case..contains(...)
is to useevent.composedPath()
instead. See also this blog post.I've had trouble creating a unit test for this bug (I could not get touch events inside shadow DOM to work with jest). I hope that the sample above will be sufficient.
I think a fix would look as simple as replacing
node.contains(event.target)
withevent.composedPath().includes(node)
. I'll gladly create a PR for this.Kind regards
The text was updated successfully, but these errors were encountered: