Skip to content

Commit

Permalink
[scene] Fix search bar loosing all it's event handlers when refreshin…
Browse files Browse the repository at this point in the history
…g while open
  • Loading branch information
EspeuteClement committed Jan 21, 2025
1 parent beab7fc commit a31e784
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions hide/comp/IconTree.hx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ class IconTree<T:{}> extends Component {
var old = waitRefresh;
waitRefresh = [];
if( searchBox != null ) {
element.append(searchBox);
searchBox = null;
openFilter(false);
searchFilter(this.filter);
}
for( f in old ) f();
Expand Down Expand Up @@ -375,10 +376,10 @@ class IconTree<T:{}> extends Component {
}
}

public function openFilter() {
public function openFilter(focus: Bool = true) {
if( async ) {
async = false;
refresh(openFilter);
refresh(openFilter.bind(focus));
return;
}
if( searchBox == null ) {
Expand All @@ -404,7 +405,9 @@ class IconTree<T:{}> extends Component {
});
}
searchBox.show();
searchBox.find("input").focus().select();
if (focus) {
searchBox.find("input").focus().select();
}
}


Expand Down

0 comments on commit a31e784

Please sign in to comment.