g").append(val);
}
},
valueField: 'value',
diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json
index e47e9aa4e..bbbaf60ec 100644
--- a/node_modules/.package-lock.json
+++ b/node_modules/.package-lock.json
@@ -76,6 +76,11 @@
"node": ">=0.10.x"
}
},
+ "node_modules/selectize-plugin-a11y": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/selectize-plugin-a11y/-/selectize-plugin-a11y-1.1.0.tgz",
+ "integrity": "sha512-fgY8fzE5Jx6DaoMg1c6otibyftkBw5y64YL778pyq7rS92h10QCPmgMaRtsHdXBFwPt6qO8qqQ1Pj1JJ0GDPrA=="
+ },
"node_modules/tippy.js": {
"version": "6.2.5",
"license": "MIT",
diff --git a/node_modules/selectize-plugin-a11y/.eslintrc b/node_modules/selectize-plugin-a11y/.eslintrc
new file mode 100644
index 000000000..b27d99080
--- /dev/null
+++ b/node_modules/selectize-plugin-a11y/.eslintrc
@@ -0,0 +1,248 @@
+{
+ "env": {
+ "browser": true,
+ "node": true,
+ "es6": false,
+ "jquery": true
+ },
+ "globals": {
+ "yTos": true,
+ "$Y": true,
+ "define": true,
+ "require": true,
+ "tc_vars": true,
+ "$M": true,
+ "attachmentLabels": true
+ },
+ "rules": {
+ "no-alert": "off",
+ "no-array-constructor": "off",
+ "no-caller": "off",
+ "no-case-declarations": "warn",
+ "no-catch-shadow": "off",
+ "no-class-assign": "error",
+ "no-confusing-arrow": "off",
+ "no-console": "off",
+ "no-const-assign": "error",
+ "no-constant-condition": "warn",
+ "no-continue": "off",
+ "no-control-regex": "error",
+ "no-debugger": "warn",
+ "no-delete-var": "error",
+ "no-div-regex": "off",
+ "no-dupe-class-members": "error",
+ "no-dupe-keys": "error",
+ "no-dupe-args": "error",
+ "no-duplicate-case": "error",
+ "no-duplicate-imports": "off",
+ "no-else-return": "off",
+ "no-empty-character-class": "error",
+ "no-empty-function": "off",
+ "no-empty-pattern": "error",
+ "no-eq-null": "off",
+ "no-eval": "off",
+ "no-ex-assign": "error",
+ "no-extend-native": "off",
+ "no-extra-bind": "off",
+ "no-extra-boolean-cast": "error",
+ "no-extra-label": "off",
+ "no-extra-parens": "off",
+ "no-extra-semi": "error",
+ "no-fallthrough": "error",
+ "no-floating-decimal": "off",
+ "no-func-assign": "error",
+ "no-implicit-coercion": "off",
+ "no-implicit-globals": "off",
+ "no-implied-eval": "off",
+ "no-inline-comments": "off",
+ "no-inner-declarations": "error",
+ "no-invalid-regexp": "error",
+ "no-irregular-whitespace": "error",
+ "no-iterator": "off",
+ "no-label-var": "off",
+ "no-labels": "off",
+ "no-lone-blocks": "off",
+ "no-lonely-if": "off",
+ "no-loop-func": "off",
+ "no-mixed-requires": "off",
+ "no-mixed-spaces-and-tabs": "error",
+ "no-multi-spaces": "off",
+ "no-multiple-empty-lines": [
+ "warn",
+ {
+ "max": 1
+ }
+ ],
+ "no-native-reassign": "off",
+ "no-negated-condition": "off",
+ "no-negated-in-lhs": "error",
+ "no-nested-ternary": "off",
+ "no-new-func": "off",
+ "no-new-object": "off",
+ "no-new-require": "off",
+ "no-new-symbol": "error",
+ "no-new-wrappers": "off",
+ "no-obj-calls": "error",
+ "no-octal": "error",
+ "no-octal-escape": "off",
+ "no-param-reassign": "off",
+ "no-path-concat": "off",
+ "no-plusplus": "off",
+ "no-process-env": "off",
+ "no-process-exit": "off",
+ "no-proto": "off",
+ "no-redeclare": "error",
+ "no-regex-spaces": "warn",
+ "no-restricted-globals": "off",
+ "no-restricted-imports": "off",
+ "no-restricted-modules": "off",
+ "no-restricted-syntax": "off",
+ "no-return-assign": "off",
+ "no-script-url": "off",
+ "no-self-assign": "error",
+ "no-self-compare": "off",
+ "no-sequences": "off",
+ "no-shadow": "off",
+ "no-shadow-restricted-names": "off",
+ "no-whitespace-before-property": "off",
+ "no-spaced-func": "warn",
+ "no-sparse-arrays": "error",
+ "no-sync": "off",
+ "no-ternary": "off",
+ "no-trailing-spaces": "off",
+ "no-this-before-super": "error",
+ "no-throw-literal": "off",
+ "no-undef": "error",
+ "no-undef-init": "off",
+ "no-undefined": "off",
+ "no-unexpected-multiline": "error",
+ "no-underscore-dangle": "off",
+ "no-unmodified-loop-condition": "off",
+ "no-unneeded-ternary": "off",
+ "no-unreachable": "error",
+ "no-unused-expressions": "off",
+ "no-unused-labels": "error",
+ "no-unused-vars": [
+ "warn",
+ {
+ "vars": "local",
+ "args": "none"
+ }
+ ],
+ "no-useless-call": "off",
+ "no-useless-concat": "off",
+ "no-useless-constructor": "off",
+ "no-void": "off",
+ "no-var": "off",
+ "no-warning-comments": "off",
+ "no-with": "off",
+ "no-magic-numbers": "off",
+ "array-bracket-spacing": "off",
+ "array-callback-return": "off",
+ "arrow-body-style": "off",
+ "arrow-parens": "off",
+ "arrow-spacing": "off",
+ "accessor-pairs": "off",
+ "block-scoped-var": "off",
+ "block-spacing": "warn",
+ "brace-style": "off",
+ "callback-return": "off",
+ "camelcase": "off",
+ "comma-dangle": "error",
+ "comma-spacing": "warn",
+ "comma-style": "off",
+ "complexity": [
+ "off",
+ 11
+ ],
+ "computed-property-spacing": "off",
+ "consistent-return": "off",
+ "consistent-this": "off",
+ "constructor-super": "error",
+ "default-case": "off",
+ "dot-location": "off",
+ "dot-notation": "off",
+ "eol-last": "off",
+ "func-names": "off",
+ "func-style": "off",
+ "generator-star-spacing": "off",
+ "global-require": "off",
+ "handle-callback-err": "off",
+ "id-length": "off",
+ "indent": ["error", 2],
+ "init-declarations": "off",
+ "jsx-quotes": "off",
+ "key-spacing": "warn",
+ "keyword-spacing": "off",
+ "lines-around-comment": "off",
+ "max-depth": "off",
+ "max-len": "off",
+ "max-nested-callbacks": "off",
+ "max-params": "off",
+ "max-statements": "off",
+ "new-parens": "off",
+ "newline-after-var": "off",
+ "newline-before-return": "off",
+ "newline-per-chained-call": "off",
+ "object-curly-spacing": [
+ "off",
+ "never"
+ ],
+ "object-shorthand": "off",
+ "one-var": [
+ "warn",
+ "never"
+ ],
+ "one-var-declaration-per-line": "off",
+ "operator-assignment": "off",
+ "operator-linebreak": "off",
+ "padded-blocks": "off",
+ "prefer-arrow-callback": "off",
+ "prefer-const": "off",
+ "prefer-reflect": "off",
+ "prefer-rest-params": "off",
+ "prefer-spread": "off",
+ "prefer-template": "off",
+ "quote-props": "off",
+ "quotes": "off",
+ "radix": "off",
+ "id-match": "off",
+ "id-blacklist": "off",
+ "require-jsdoc": "off",
+ "require-yield": "off",
+ "semi": "warn",
+ "semi-spacing": "warn",
+ "sort-vars": "off",
+ "sort-imports": "off",
+ "space-before-blocks": "warn",
+ "space-before-function-paren": "warn",
+ "space-in-parens": "warn",
+ "space-infix-ops": "off",
+ "space-unary-ops": "off",
+ "spaced-comment": "off",
+ "strict": "off",
+ "template-curly-spacing": "off",
+ "use-isnan": "error",
+ "valid-jsdoc": "off",
+ "valid-typeof": "error",
+ "vars-on-top": "off",
+ "wrap-regex": "off",
+ "yield-star-spacing": "off",
+ "yoda": "off",
+ "no-bitwise": 2,
+ "curly": 0,
+ "eqeqeq": 0,
+ "guard-for-in": 2,
+ "no-cond-assign": [
+ 2,
+ "except-parens"
+ ],
+ "wrap-iife": 0,
+ "linebreak-style": 0,
+ "no-use-before-define": 0,
+ "no-multi-str": 2,
+ "new-cap": 0,
+ "no-empty": 2,
+ "no-new": 2
+ }
+}
diff --git a/node_modules/selectize-plugin-a11y/LICENSE b/node_modules/selectize-plugin-a11y/LICENSE
new file mode 100644
index 000000000..d33fbaa64
--- /dev/null
+++ b/node_modules/selectize-plugin-a11y/LICENSE
@@ -0,0 +1,7 @@
+Copyright 2018-present Salmen Bejaoui
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/selectize-plugin-a11y/README.md b/node_modules/selectize-plugin-a11y/README.md
new file mode 100644
index 000000000..9c42eff2e
--- /dev/null
+++ b/node_modules/selectize-plugin-a11y/README.md
@@ -0,0 +1,24 @@
+# selectize-plugin-a11y.js
+Selectize-plugin-a11y is a plugin to make Selectize.js accessible as a Combobox.
+
+## Selectize-plugin-a11y – Usage
+
+```html
+
+
+
+```
+
+## Pull requests are always welcome
+Any pull request to improve the plugin will be appreciated 😉
diff --git a/node_modules/selectize-plugin-a11y/examples/api.html b/node_modules/selectize-plugin-a11y/examples/api.html
new file mode 100644
index 000000000..a37aeb791
--- /dev/null
+++ b/node_modules/selectize-plugin-a11y/examples/api.html
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
Accessibile Selectize
+
+
+
+
Selectize-plugin-a11y.js
+
Make Selectize.js accessibile
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/node_modules/selectize-plugin-a11y/package.json b/node_modules/selectize-plugin-a11y/package.json
new file mode 100644
index 000000000..8e4ccbf8f
--- /dev/null
+++ b/node_modules/selectize-plugin-a11y/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "selectize-plugin-a11y",
+ "version": "1.1.0",
+ "description": "Make Selectize.js accessibile",
+ "main": "selectize-plugin-a11y.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/SLMNBJ/selectize-plugin-a11y.git"
+ },
+ "keywords": [
+ "selectize",
+ "selectize.js",
+ "a11y",
+ "accessibility",
+ "selectize",
+ "voiceover"
+ ],
+ "author": "Salmen Bejaoui",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/SLMNBJ/selectize-plugin-a11y/issues"
+ },
+ "homepage": "https://github.com/SLMNBJ/selectize-plugin-a11y#readme"
+}
diff --git a/node_modules/selectize-plugin-a11y/selectize-plugin-a11y.js b/node_modules/selectize-plugin-a11y/selectize-plugin-a11y.js
new file mode 100644
index 000000000..a91d72a7c
--- /dev/null
+++ b/node_modules/selectize-plugin-a11y/selectize-plugin-a11y.js
@@ -0,0 +1,141 @@
+/* global Selectize */
+Selectize.define("selectize-plugin-a11y", function (options) {
+ var self = this;
+ var KEY_RETURN = 13;
+
+ if (typeof self.accessibility === "undefined") {
+ self.accessibility = {};
+ }
+
+ self.accessibility.helpers = {
+ randomId: function (len) {
+ var str = "",
+ strLength = len || 10,
+ base = "abcdefghijklmnopqrstuvwxyz0123456789",
+ baseLength = base.length;
+
+ for (var i = 0; i < strLength; i++) {
+ str += base[Math.floor(baseLength * Math.random())];
+ }
+
+ return str;
+ }
+ };
+
+ self.accessibility.liveRegion = {
+ $region: "",
+ speak: function (msg) {
+ var $container = $("
");
+ $container.text(msg);
+ this.$region.html($container);
+ },
+ domListener: function () {
+ var observer = new MutationObserver(function (mutations) {
+ mutations.forEach(function (mutation) {
+ var $target = $(mutation.target);
+ if ($target.hasClass("items")) {
+ if ($target.hasClass("dropdown-active")) {
+ // open
+ self.$control_input.attr("aria-expanded", "true");
+ } else {
+ // close
+ self.$control_input.attr("aria-expanded", "false");
+ self.$control_input.removeAttr("aria-activedescendant");
+ }
+ } else {
+ // option change
+ if ($target.hasClass("active")) {
+ if (!!$target.attr("data-value")) { // eslint-disable-line no-extra-boolean-cast
+ self.$control_input.attr(
+ "aria-activedescendant",
+ $target.attr("id")
+ );
+ self.accessibility.liveRegion.speak($target.text(), 500);
+ }
+ }
+ }
+ });
+ });
+ observer.observe(self.$dropdown[0], {
+ attributes: true,
+ attributeFilter: ["class"],
+ subtree: true,
+ attributeOldValue: true
+ });
+
+ observer.observe(self.$control[0], {
+ attributes: true,
+ attributeFilter: ["class"]
+ });
+
+ observer.observe(self.$control_input[0], {
+ attributes: true,
+ attributeFilter: ["value"]
+ });
+ },
+ setAttributes: function () {
+ this.$region.attr({
+ "aria-live": "assertive",
+ role: "log",
+ "aria-relevant": "additions",
+ "aria-atomic": "true"
+ });
+ },
+ setStyles: function () {
+ this.$region.css({
+ position: "absolute",
+ width: "1px",
+ height: "1px",
+ "margin-top": "-1px",
+ clip: "rect(1px, 1px, 1px, 1px)",
+ overflow: "hidden"
+ });
+ },
+ init: function () {
+ this.$region = $("
");
+ this.setAttributes();
+ this.setStyles();
+ $("body").append(this.$region);
+ this.domListener();
+ }
+ };
+
+ this.setup = (function () {
+ var original = self.setup;
+ return function () {
+ original.apply(this, arguments);
+ var inputId = self.accessibility.helpers.randomId(),
+ listboxId = self.accessibility.helpers.randomId();
+
+ self.$control.on("keydown", function (e) {
+ if (e.keyCode === KEY_RETURN) {
+ $(this).click();
+ }
+ });
+
+ self.$control_input.attr({
+ role: "combobox",
+ "aria-expanded": "false",
+ haspopup: "listbox",
+ "aria-owns": listboxId,
+ "aria-label": self.$wrapper
+ .closest("[data-accessibility-selectize-label]")
+ .attr("data-accessibility-selectize-label")
+ });
+ console.log( self.$wrapper);
+ self.$dropdown_content.attr({
+ role: "listbox",
+ id: listboxId
+ });
+ self.accessibility.liveRegion.init();
+ };
+ })();
+
+ this.destroy = (function () {
+ var original = self.destroy;
+ return function () {
+ self.accessibility.liveRegion.$region.remove();
+ return original.apply(this, arguments);
+ };
+ })();
+});
diff --git a/package-lock.json b/package-lock.json
index 0a8500242..fad6dec4e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14,6 +14,7 @@
"datatables.net-scroller": "^1.4.2",
"datatables.net-select": "^1.2.0",
"scrollmagic": "^2.0.8",
+ "selectize-plugin-a11y": "^1.1.0",
"tippy.js": "^6.2.5"
}
},
@@ -90,6 +91,11 @@
"node": ">=0.10.x"
}
},
+ "node_modules/selectize-plugin-a11y": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/selectize-plugin-a11y/-/selectize-plugin-a11y-1.1.0.tgz",
+ "integrity": "sha512-fgY8fzE5Jx6DaoMg1c6otibyftkBw5y64YL778pyq7rS92h10QCPmgMaRtsHdXBFwPt6qO8qqQ1Pj1JJ0GDPrA=="
+ },
"node_modules/tippy.js": {
"version": "6.2.5",
"license": "MIT",
@@ -162,6 +168,11 @@
"scrollmagic": {
"version": "2.0.8"
},
+ "selectize-plugin-a11y": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/selectize-plugin-a11y/-/selectize-plugin-a11y-1.1.0.tgz",
+ "integrity": "sha512-fgY8fzE5Jx6DaoMg1c6otibyftkBw5y64YL778pyq7rS92h10QCPmgMaRtsHdXBFwPt6qO8qqQ1Pj1JJ0GDPrA=="
+ },
"tippy.js": {
"version": "6.2.5",
"requires": {
diff --git a/package.json b/package.json
index 84599bb18..9a3b0597a 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,6 @@
{
"dependencies": {
+ "@fontsource/raleway": "^4.5.0",
"@popperjs/core": "^2.4.4",
"bulma-scss": "^0.9.0-1",
"datatables.net": "^1.10.12",
@@ -7,8 +8,8 @@
"datatables.net-responsive": "^2.1.0",
"datatables.net-scroller": "^1.4.2",
"datatables.net-select": "^1.2.0",
- "@fontsource/raleway": "^4.5.0",
"scrollmagic": "^2.0.8",
+ "selectize-plugin-a11y": "^1.1.0",
"tippy.js": "^6.2.5"
}
}
diff --git a/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php b/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php
index 8219d4ed6..5ba104671 100644
--- a/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php
+++ b/sources/application/UI/Base/Layout/NavigationMenu/NavigationMenu.php
@@ -338,7 +338,7 @@ class NavigationMenu extends UIBlock implements iKeyboardShortcut
$oWidget = new UIExtKeyWidget('Organization', 'org_id', '', true /* search mode */);
$iMaxComboLength = MetaModel::GetConfig()->Get('max_combo_length');
- $this->aSiloSelection['html'] .= $oWidget->DisplaySelect($oPage, $iMaxComboLength, false, '', $oSet, $iCurrentOrganization, false, 'c[org_id]', '',
+ $this->aSiloSelection['html'] .= $oWidget->DisplaySelect($oPage, $iMaxComboLength, false, Dict::S('UI:Layout:NavigationMenu:Silo:Label'), $oSet, $iCurrentOrganization, false, 'c[org_id]', '',
array(
'iFieldSize' => 20,
'iMinChars' => MetaModel::GetConfig()->Get('min_autocomplete_chars'),
diff --git a/sources/application/WebPage/iTopWebPage.php b/sources/application/WebPage/iTopWebPage.php
index 9e76a49e4..318af9c42 100644
--- a/sources/application/WebPage/iTopWebPage.php
+++ b/sources/application/WebPage/iTopWebPage.php
@@ -161,6 +161,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
// Used by external keys and other drop down lists
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/selectize.min.js');
+ $this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'node_modules/selectize-plugin-a11y/selectize-plugin-a11y.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.multiselect.js');
// Used by inline image, CKEditor and other places
diff --git a/templates/base/layouts/navigation-menu/layout.html.twig b/templates/base/layouts/navigation-menu/layout.html.twig
index 12f796be9..8ed00b7e2 100644
--- a/templates/base/layouts/navigation-menu/layout.html.twig
+++ b/templates/base/layouts/navigation-menu/layout.html.twig
@@ -45,7 +45,7 @@
{% endif %}