Reporting this again because it’s still happening after seven months. :\
BUG: If you tag a file and then (after that tag goes through) immediately attempt to type another tag, the text you enter into the textbox may be erased repeatedly as you type. This bug always happens under certain conditions.
HOW TO REPRODUCE: Do a File search for anything that will return at least one file.
Click a file’s thumbnail to go into Details View on that file. Then, click outside of Details View to close it. Repeat this step exactly ten more times. Do not attempt to interact with any of these files (tagging, Liking, etc.).
If your browser has a debugging tool that lets you view AJAX requests, open it now.
Open a file’s Details View again. Clear any output in your debugging tool. Attempt to apply a tag to this file. The moment the tag is successfully applied, attempt to type another tag, as if you were going to apply it.
TIP FOR MOUSE USERS: Use your keyboard to perform these steps more quickly and bring out the bug. TAB from the tag textbox to the “Tag” button and hit Enter to apply the tag. when the textbox reappears, SHIFT+TAB back to it and start typing immediately.
You should see the text that you’re trying to type get deleted as you type it. If you have a debugger open, you should also see that twelve AJAX requests were sent just for the one tag that you applied, and that the text you’ve been typing into the textbox is being cleared every time one of those requests completes. That’s one AJAX request for every time you opened any file’s Details View.
EXPLANATION: Every time you go into Details View on a file, a new copy of the JavaScript event handler for the “Tag” button is attached to that button.
The first time you open a file’s details, things work fine. You can apply as many tags as you want, and everything will work normally.
The second time you open a file’s details, you will send two AJAX requests every time you apply one tag. Each time one of those requests completes, the contents of the textbox for tagging are wiped, interfering with typing.
The third time you open a file’s details, you will send three AJAX requests every time you apply one tag, making this bug occur. Again, the textbox will be wiped with each completed AJAX request, interfering with typing.
The problem continues and gets worse every time you open the “fancybox” on a file, eventually building to the point where you won’t be able to type in any tags at all for several seconds after applying a tag to a file.
ADVICE ON FIXING: Modify the JavaScript function that gets stored at UGC.Tags.init to either use a run-once flag, or replace all references to itself with an empty function after it does what it needs to do.
I wrote a userscript to apply the fix as a monkeypatch, and the issue is completely gone when the userscript runs.