Hi vakhtang zubiashvili,
Which version of the JavaScript API are you using, 3.x or 4.x?
I can provide you with a little example (using 4.13) where a parcel is highlighted when clicked and 'unhighlighted' when the popup is closed: Aan de slag met ArcGIS JavaScript - DKK Geocoder
The relevant piece of code is shown below. But, as you can see from my notes, it was not me who figured this out. No it was Robert Scheitlin, GISP...
Is this example useful to you?
Cheers,
Egge-Jan
view.popup.watch('selectedFeature', function(gra){
if(gra){
view.graphics.removeAll();
let h = view.highlightOptions;
gra.symbol = {
type: "simple-fill",
color: [h.color.r,h.color.g, h.color.b, h.fillOpacity],
outline: {
color: [h.color.r,h.color.g, h.color.b, h.color.a],
width: 1
}
};
view.graphics.add(gra);
}else{
view.graphics.removeAll();
}
});
view.popup.watch('visible', function(vis){
if(!vis){
view.graphics.removeAll();
}
});