-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
help wantedExtra attention is neededExtra attention is neededquestionFurther information is requestedFurther information is requested
Description
In order for x-topic-search's results to be closed when you interact with something else on the page, we need do something like this:
['focusout', 'focusin', 'click'].forEach(action => {
document.body.addEventListener(action, event => {
if(!componentRootNode.contains(event.target)) {
topicSearchActions.hideResult();
}
});
});
(We can't just listen for the blur
of the topic search input, as this will cause the search results to close when you click inside the search results (e.g. on the follow button).)
So, there's a couple of questions:
- What is an acceptable way for an x-dash component to add (and remove) DOM event listeners outside of themselves? (we should avoid it if we can, but in this case it seems unavoidable).
- How to pass a ref to a DOM node from the wrapped component to the action? E.g. the event handler has this condition:
componentRootNode.contains(event.target)
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is neededquestionFurther information is requestedFurther information is requested