Mercurial > libervia-web
diff libervia/web/pages/_browser/jid_search.py @ 1591:f1d09a4d38dc
browser (jid_search): fix `submit_filter` when there is no parent `<form>`
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 10 Dec 2023 11:01:57 +0100 |
parents | 02432346e9b2 |
children | c6976c5b85a1 |
line wrap: on
line diff
--- a/libervia/web/pages/_browser/jid_search.py Sun Dec 10 11:01:19 2023 +0100 +++ b/libervia/web/pages/_browser/jid_search.py Sun Dec 10 11:01:57 2023 +0100 @@ -47,8 +47,12 @@ self.search_elt = search_elt self.search_elt.bind("input", self.on_search_input) if submit_filter: - form_elt = self.search_elt.closest("form") - form_elt.bind("submit", self.on_form_submit) + try: + form_elt = self.search_elt.closest("form") + except KeyError: + log.debug("No parent <form> found, can't apply submit filter.") + else: + form_elt.bind("submit", self.on_form_submit) self.last_query = None self.current_query = None self.container_elt = container_elt