Bug 23050: Fix tab's id to avoid compatibility issues
authorJulian Maurice <julian.maurice@biblibre.com>
Mon, 15 Jul 2019 12:28:47 +0000 (14:28 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 5 Nov 2019 08:13:45 +0000 (08:13 +0000)
MDN says:

  Using characters except ASCII letters, digits, '_', '-' and '.' may
  cause compatibility problems, as they weren't allowed in HTML 4.
  Though this restriction has been lifted in HTML5, an ID should start
  with a letter for compatibility.

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

catalogue/detail.pl

index 1103d2e..e86a115 100755 (executable)
@@ -77,8 +77,8 @@ if ( C4::Context->preference('UseKohaPlugins') &&
     foreach my $tab_plugin (@tab_plugins) {
         my @biblio_tabs = $tab_plugin->intranet_catalog_biblio_tab();
         foreach my $tab (@biblio_tabs) {
-            $tab->{id} = $tab->{title};
-            $tab->{id} =~ s/[^\w]+/-/g;
+            $tab->{id} = 'tab-' + $tab->{title};
+            $tab->{id} =~ s/[^0-9A-Za-z]+/-/g;
             push @tabs, $tab,
         }
     }