You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After about 8 seconds since the modal is opened it loses the focus automatically, even if I don't do anything.
After it loses the focus, if I manually re-focus it, then textDidChange events are still no longer fired.
constAPPS=['1Password','Xcode'];functionfuzzyMatch(needle,haystack){if(needle===""||haystack==="")returntrue;needle=needle.toLowerCase().replace(//g,"");haystack=haystack.toLowerCase();// All characters in needle must be present in haystackvarj=0;// haystack positionfor(vari=0;i<needle.length;i++){// Go down the haystack until we find the current needle characterwhile(needle[i]!==haystack[j]){j++;// If we reached the end of the haystack, then this is not a matchif(j===haystack.length){returnfalse;}}// Here, needle character is same as haystack character//console.log(needle + ":" + i + " === " + haystack + ":" + j);}// At this point, we have matched every single letter in the needle without returning falsereturntrue;}constmodal=Modal.build({origin: {x: 300,y: 300},weight: 25,animationDuration: .2,appearance: 'dark',text: 'Search...',isInput: true,icon: App.get('Phoenix').icon(),textDidChange(text){// appendFile ( '/Users/fabio/Desktop/output.txt', `[${text}]\n` );constapp=APPS.find(app=>fuzzyMatch(text,app));// appendFile ( '/Users/fabio/Desktop/output.txt', `${text} - ${app}\n` );}});modal.show();
The text was updated successfully, but these errors were encountered:
Somehow one of these input modals survived restarting Phoenix for me, so I can't close it anymore 🤔
Edit: it seems to survive a reload if Phoenix reloads itself, but it seems to close itself correctly if I call Phoenix.reload manually myself. Though it doesn't behave consistently, so maybe I'm seeing a pattern that doesn't exist.
Edit: also each time I open a new modal at the same coordinates it opens slightly offset from the point I set, which seems symptomatic of some other, possibly related, bug.
@fabiospampinato Hi, thanks for the report! After debugging this looks to me as a memory management issue. I clarified the documentation that you must always keep a reference for the modal to stay active. Otherwise the callback for text changes will not get called once it gets released in the background.
To avoid mistakes, I also changed it so that Modal#show() will return the modal itself for chaining. Finally, there was an issue that the window was not getting closed properly when it got deallocated from the JavaScript context. This should also now be fixed.
With the following code I see two problems:
textDidChange
events are still no longer fired.The text was updated successfully, but these errors were encountered: