View Issue Details

IDProjectCategoryView StatusLast Update
0010038mantisbttaggingpublic2009-04-20 09:49
Reporterolegos Assigned Tojreese  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Versiongit trunk 
Fixed in Version1.1.7 
Summary0010038: Problems attaching tags in Chrome
Description

Attaching tags with Google Chrome browser from the View Issue page.

In this tracker ("Mantis 1.2.0a2 git snapshot 1feb832"), after attaching a tag, clicking anywhere else (taking focus away from the tags drop-down list) appends a comma to the Attach Tags string. Then selecting another tag from the drop-down list results in a string with two commas in a row (e.g. "install,,error,").

On my own tracker, fairly recent 1.2.0a2 snapshot (svn r5751, with a number of later bugs backported), it's worse: ",Existing tags" gets appended, and a new tag "Existing tags" gets created.

The cause seems to be that the onchange action of the tag_select box gets called when focus goes away. I fixed this on my tracker for now by adding

if (p_string != '' && p_string != 'Existing tags')

around the code in tag_string_append() in javascript/common.js. I think this is a good check to have in any case, to guard against current & future browser brokenness.

I wasn't able to figure out the reason for the different behavior between my installation and this one. All relevant files are the same (view.php, core/tag_api.php, javascript/common.js) except for minor formatting changes. Any ideas where else to look?

By the way, you should delete "Existing tags" tag on this tracker (
http://www.mantisbt.org/bugs/tag_view_page.php?tag_id=53 ). So at some point it was possible to get it created & attached here too. What was the change that fixed it?

Tagspatch
Attached Files
bug10038.patch (803 bytes)   
--- common.js.orig	2009-01-13 10:44:41.707409950 -0600
+++ common.js	2009-01-13 10:45:07.667412734 -0600
@@ -156,10 +156,12 @@
 	t_tag_separator = document.getElementById('tag_separator').value;
 	t_tag_string = document.getElementById('tag_string');
 	t_tag_select = document.getElementById('tag_select');
-	if ( t_tag_string.value != '' ) {
-		t_tag_string.value = t_tag_string.value + t_tag_separator + p_string;
-	} else {
-		t_tag_string.value = t_tag_string.value + p_string;
+	if (p_string != '' && p_string != t_tag_select.options[0].text) {  /* ignore "Existing tags" */
+		if ( t_tag_string.value != '' ) {
+			t_tag_string.value = t_tag_string.value + t_tag_separator + p_string;
+		} else {
+			t_tag_string.value = t_tag_string.value + p_string;
+		}
 	}
 	t_tag_select.selectedIndex=0;
 }
bug10038.patch (803 bytes)   

Activities

giallu

giallu

2009-01-10 07:09

reporter   ~0020572

I deleted the "Existing tags" tag here.

if you want to upgrade, download the latest snapshot from:

http://git.mantisbt.org/?p=mantisbt.git;a=shortlog;h=refs/heads/master

clicking on the "snapshot" link, so you can check if you're able to get a consistent behavior

giallu

giallu

2009-01-10 10:11

reporter   ~0020574

and BTW, your fix is not going to work for all of your users not using the english language, because that string is translated.

olegos

olegos

2009-01-10 10:32

reporter   ~0020575

Yes, that's where I got the source for the latest version that I was comparing against. I don't want to upgrade just yet -- since it looks like 1.2.0a3 is just around the corner, I'll wait for it. (Since you guys switched from subversion, upgrades became a lot more difficult for me -- I haven't figured out git yet.)

English only -- yes, I knew that. My tracker is private and all users use English. And besides, it's trivial to make my fix work for other languages.

olegos

olegos

2009-01-13 11:51

reporter   ~0020610

Last edited: 2009-01-13 14:25

A patch in a language-independent way for git trunk is attached.

jreese

jreese

2009-01-13 15:24

reporter   ~0020612

Fix committed to 1.1.7 and 1.2.x development trees.

olegos

olegos

2009-01-15 14:58

reporter   ~0020631

I apologize, I wasn't trying to re-open this issue, I was testing something else. This issue can be resolved.

Related Changesets

MantisBT: master 5061832e

2009-01-13 13:31

jreese


Details Diff
Fix 0010038: Prevent attaching empty tag strings.
Fixes problem with Chrome browser generating JS event for 'Existing tags'.
Affected Issues
0010038
mod - javascript/common.js Diff File

MantisBT: master-1.1.x dd91387c

2009-01-13 13:31

jreese


Details Diff
Fix 0010038: Prevent attaching empty tag strings.
Fixes problem with Chrome browser generating JS event for 'Existing tags'.
Affected Issues
0010038
mod - javascript/common.js Diff File

MantisBT: master b2a0d81e

2009-01-13 13:31

jreese


Details Diff
Fix 0010038: Prevent attaching empty tag strings.
Fixes problem with Chrome browser generating JS event for 'Existing tags'.
Affected Issues
0010038
mod - javascript/common.js Diff File