4.22 Search Widget Menu Bug

3759
8
Jump to solution
01-25-2022 04:19 PM
JoelBennett
MVP Regular Contributor

A bug exists in the Search widget such that when the sources menu is open, and you click the arrow button on the left of the widget (presumably to close it), the menu will close, and then immediately re-open.  This can be verified in the sample "Search widget with multiple sources". This behavior has also been present in releases prior to 4.22, but the suggested fix below may not work in anything other than 4.22.

If you have a locally hosted copy of the API, you can fix this problem by doing the following find-and-replace in esri/widgets/Search.js:

 

Search for:

onfocus:this._clearActiveMenu,afterCreate:G.storeNode,

 

Replace with:

onfocus:function(){if(this.activeMenu!="source")this._clearActiveMenu();}.bind(this),afterCreate:G.storeNode,

 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
Noah-Sager
Esri Regular Contributor

Hi @JoelBennett, good news. We'll have the Search widget enhanced at the next release (4.23, due out in March) so that the expanded dropdown arrow now closes the list of locators instead of closing and then reopening. See it in action here: https://codepen.io/noash/pen/LYOWGGK?editors=1000

 

View solution in original post

8 Replies
Noah-Sager
Esri Regular Contributor

Hi @JoelBennett, I'm not sure I understand the issue. The arrow button in the left side of the Search widget is for selecting different locators:

 

0 Kudos
JoelBennett
MVP Regular Contributor

Aloha @Noah-Sager, thanks for the follow-up.  To see the issue I'm talking about, (1) click the dropdown arrow so it lists the sources, then (2) without clicking any sources, click the dropdown arrow again.  It's expected that the dropdown would close, which it does, but unfortunately, opens again immediately.

0 Kudos
Noah-Sager
Esri Regular Contributor

Aloha? I wish. It's cold here. Ok, I see what you're talking about now. Let me do some digging.

0 Kudos
Noah-Sager
Esri Regular Contributor

Hi @JoelBennett, good news. We'll have the Search widget enhanced at the next release (4.23, due out in March) so that the expanded dropdown arrow now closes the list of locators instead of closing and then reopening. See it in action here: https://codepen.io/noash/pen/LYOWGGK?editors=1000

 

JoelBennett
MVP Regular Contributor

Looks good @Noah-Sager, thanks for the fix and the follow-up!

0 Kudos
Noah-Sager
Esri Regular Contributor

Excellent! Feel free to accept as solution the above post if you feel I've addressed the issue.

0 Kudos
JoelBennett
MVP Regular Contributor

Certainly...will do once I've tested in the 4.23 release.

0 Kudos
JoelBennett
MVP Regular Contributor

After testing with 4.23, I've confirmed this one is fixed.

P.S. @Noah-Sager if you'd like an easy kill for the 4.24 bug fix list, this one is still in play.

0 Kudos