? Failure

User tests: Successful: Unsuccessful:

avatar A-Kasaaian
A-Kasaaian
9 Oct 2016

Pull Request for Issue # .

Summary of Changes

A solution for: #10761
The issue was created by "event.which === 188" which means ',' on keyup event but I changed it to 2 different events. Keyup to check if enter is pressed and keypress to check if ',' is pressed while typing in English. An event listener is changed to two event listener and a function.

Testing Instructions

I tested code with multiple languages such as Hebrew, Persian, Arabic and ... to see if there is a key charCode equal to 44 among their numbers and alphabet which would cause issues and other key code tests and typing test in Joomla tag field to make sure there is no conflict. I found out that 44 is probably an unique charCode. The code passed all tests successfully

Documentation Changes Required

There is an issue in typing tags in different languages. Pressing ',' in tags means you are done and it will be saved, but it's only for English not other languages such as Arabic, Persian, Hebrew and ... which was bothering me and many other Joomla users. So that I made changes to solve this problem. Now, you can press ',' but it submits tag just if you are typing in English language and if you are typing in other languages continue as long as you want and press enter at the end. Tested in many languages and everything works fine.

avatar A-Kasaaian A-Kasaaian - open - 9 Oct 2016
avatar A-Kasaaian A-Kasaaian - change - 9 Oct 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 9 Oct 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 9 Oct 2016
Category Layout
avatar brianteeman brianteeman - change - 9 Oct 2016
Category Layout Layout Tags
avatar rdeutz rdeutz - change - 27 May 2017
The description was changed
avatar joomla-cms-bot joomla-cms-bot - change - 27 May 2017
Category Layout com_tags Layout
avatar csthomas
csthomas - comment - 20 Oct 2017

Hi, IMO comma should not be added to tag when there is only a few letters (less that 3).

Can you test and add this changes:

diff --git a/layouts/joomla/html/tag.php b/layouts/joomla/html/tag.php
index abc6a6fdcd..2e8e055b40 100644
--- a/layouts/joomla/html/tag.php
+++ b/layouts/joomla/html/tag.php
@@ -43,9 +43,9 @@ if ($allowCustom)
        JFactory::getDocument()->addScriptDeclaration(
                "
                jQuery(document).ready(function ($) {
-      var customTagPrefix = '#new#';
+                       var customTagPrefix = '#new#';
 
-                       function tagHandler(event,element){
+                       function tagHandler(event,element) {
                                        // Search an highlighted result
 
                                        var highlighted = $('" . $selector . "_chzn').find('li.active-result.highlighted').first();
@@ -85,23 +85,27 @@ if ($allowCustom)
 
                                        element.value = '';
                                        $('" . $selector . "').trigger('liszt:updated');
-                                       event.preventDefault();
-
                        }
 
                        // Method to add tags pressing enter
                        $('" . $selector . "_chzn input').keypress(function(event) {
-                               // Tag is greater than the minimum required chars and enter pressed
-                               if (this.value && this.value.length >= " . $minTermLength . " && (event.which === 13 || event.charCode === 44)) {
+                               // Comma pressed
+                               if (event.charCode === 44) {
+                                       // Tag is greater than the minimum required chars
+                                       if (this.value && this.value.length >= " . $minTermLength . ") {
+                                               tagHandler(event,this);
+                                       }
 
-                                       tagHandler(event,this);
+                                       // Do not add comma to tag
+                                       event.preventDefault();
                                }
                        });
+
                        $('" . $selector . "_chzn input').keyup(function(event) {
                                // Tag is greater than the minimum required chars and enter pressed
-                               if (this.value && this.value.length >= " . $minTermLength . " && (event.which === 13)) {
-
+                               if (event.which === 13 && this.value && this.value.length >= " . $minTermLength . ") {
                                        tagHandler(event,this);
+                                       event.preventDefault();
                                }
                        });
                });
avatar A-Kasaaian
A-Kasaaian - comment - 15 Nov 2017

@csthomas everything must be OK by now

avatar csthomas
csthomas - comment - 15 Nov 2017

From code review: I suggest to not deleting blank lines in more cases, before comments and after closing parentheses such as } or );.

avatar A-Kasaaian
A-Kasaaian - comment - 15 Nov 2017

I didn't. It had been done previously. This time I just copied this version and changed two parts, which is described in the last commit here.

avatar csthomas
csthomas - comment - 15 Nov 2017
avatar A-Kasaaian
A-Kasaaian - comment - 15 Nov 2017

OK that was a mistake because I didn't copy and past properly. It's resolved now,

avatar csthomas
csthomas - comment - 20 Nov 2017

I tested you PR unsuccessful because the enter button has stopped working.

I have created different PR #18768 that should solve your problem.

avatar franz-wohlkoenig franz-wohlkoenig - alter_testresult - 21 Nov 2017 - csthomas: Tested unsuccessfully
avatar franz-wohlkoenig franz-wohlkoenig - change - 21 Nov 2017
The description was changed
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-11-21 06:23:46
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 21 Nov 2017
Status Closed Pending
avatar joomla-cms-bot joomla-cms-bot - change - 21 Nov 2017
The description was changed
Status Pending Closed
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot
joomla-cms-bot - comment - 21 Nov 2017
avatar joomla-cms-bot joomla-cms-bot - edited - 21 Nov 2017
avatar joomla-cms-bot joomla-cms-bot - close - 21 Nov 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 21 Nov 2017

closed in Favor of #18768.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12366.

Add a Comment

Login with GitHub to post a comment