* Alert if clicked on outside of element
(event)
| 234 | * Alert if clicked on outside of element |
| 235 | */ |
| 236 | function handleClickOutside(event) { |
| 237 | if (ref.current && !ref.current.contains(event.target)) { |
| 238 | let input_element = document.getElementById('live-search-field'); |
| 239 | if(input_element == null){ |
| 240 | return; |
| 241 | } |
| 242 | let input_value = input_element.value; |
| 243 | if(input_value && input_value.length > 0){ |
| 244 | toggleDropdownMenu(); |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | // Bind the event listener |
| 249 | document.addEventListener('mousedown', handleClickOutside); |
| 250 | return () => { |
nothing calls this directly
no test coverage detected