fix/search-preview #51

Merged
nrupard merged 4 commits from fix/search-preview into main 2026-05-06 20:21:14 +02:00
Owner
No description provided.
The sidebar's message and people search inputs targeted #main with hx-push-url, so each keystroke replaced the whole content panel and pushed a URL, making the result preview look like its own page. With an empty input the handlers also rendered a "People: \"\"" / "Search: \"\"" panel with a "no matches" body that never disappeared until the user navigated away.

Each search input now gets its own absolutely-positioned popover container directly beneath it (#search-msg-results, #search-people-results) with empty:hidden so the popover collapses when empty. The handlers return an empty body for an empty (or sanitisation-empty) query, and the templates drop the page-style header in favour of a compact card. The block button is removed from the people popover; users can still block via the DM page or /settings/blocked.
Adds the same /users/search popover used in the sidebar to the "Block by username" input on /settings/blocked, so users can confirm a username (including private profiles, since search now ignores profile visibility for blocking) before submitting the form. Each result row carries a data-username attribute, and a small inline script intercepts clicks on the blocked-page popover to fill the input and dismiss the dropdown rather than navigating to the DM page (which is the default behaviour everywhere else the popover is used). The dropdown also clears on click outside.
The input has name="username" so HTMX serialised the form value as
?username=... when triggering the popover request. The /users/search
handler reads `q`, treated the request as empty, and returned an empty
body. Set hx-params="none" to drop form serialisation and use hx-vals
to inject the input's current value as `q`. Also drop the keyup[Enter]
trigger so Enter submits the block form instead of firing the search.
The previous attempt routed the popover through HTMX, but the input's
name="username" caused HTMX to serialise the form value as ?username=...
and the workaround via hx-params/hx-vals never produced a working request.
Replace the hx-* attributes with a small inline script that debounces
input events, calls /users/search?q=<value> via fetch, and writes the
response into #block-search-results. Click handlers for filling the input
and dismissing on outside-click are unchanged.
nrupard deleted branch fix/search-preview 2026-05-06 20:21:15 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/lets-chat!51
No description provided.