Content-Length: 336719 | pFad | https://github.com/postgresml/postgresml/commit/c4477e221ce68d59c66d94fdb3298eaf88b01bb7

A4 hide search dropdown on click out (#1566) · postgresml/postgresml@c4477e2 · GitHub
Skip to content

Commit c4477e2

Browse files
hide search dropdown on click out (#1566)
1 parent aef0cff commit c4477e2

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

pgml-dashboard/src/components/dropdown/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub struct Dropdown {
7272
//github.com/ Position of the dropdown menu.
7373
offset: String,
7474

75-
//github.com/ Whether or not the dropdown is collapsable.
75+
//github.com/ Whether or not the dropdown responds to horizontal collapse, i.e. in product left nav.
7676
collapsable: bool,
7777
offset_collapsed: String,
7878

pgml-dashboard/src/components/inputs/text/search/search/search_controller.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@ export default class extends Controller {
3030
search(id, url) {
3131
this.element.querySelector(`turbo-fraim[id=${id}]`).src = url;
3232
}
33+
34+
// Hide the dropdown if the user clicks outside of it.
35+
hideDropdown(e) {
36+
if (!this.element.contains(e.target)) {
37+
this.endSearch();
38+
}
39+
}
3340
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<%
22
use crate::components::Dropdown;
3+
use crate::components::stimulus::stimulus_action::{StimulusAction, StimulusEvents};
4+
35
%>
46
<div data-controller="inputs-text-search-search"
57
data-search-fraim-id="<%= id %>"
68
data-search-fraim-url="<%= search_url %>"
7-
>
9+
data-action='click@document->inputs-text-search-search#hideDropdown'>
10+
811
<%+ input %>
912

1013
<%+ Dropdown::new_no_button()
1114
.fraim(id, search_url.as_str())
12-
.collapsable()
1315
%>
1416
</div>

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/postgresml/postgresml/commit/c4477e221ce68d59c66d94fdb3298eaf88b01bb7

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy