Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

selectize-plugin-a11y

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

selectize-plugin-a11y - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

.eslintrc

4

package.json
{
"name": "selectize-plugin-a11y",
"version": "1.0.3",
"version": "1.0.4",
"description": "Make Selectize.js accessibile",

@@ -22,3 +22,3 @@ "main": "selectize-plugin-a11y.js",

"author": "Salmen Bejaoui",
"license": "ISC",
"license": "MIT",
"bugs": {

@@ -25,0 +25,0 @@ "url": "https://github.com/SLMNBJ/selectize-plugin-a11y/issues"

@@ -1,3 +0,6 @@

Selectize.define("selectize-plugin-a11y", function(options) {
let self = this;
/* global Selectize */
Selectize.define("selectize-plugin-a11y", function (options) {
var self = this;
var KEY_RETURN = 13;
if (typeof self.accessibility === "undefined") {

@@ -8,4 +11,4 @@ self.accessibility = {};

self.accessibility.helpers = {
randomId: function(len) {
let str = "",
randomId: function (len) {
var str = "",
strLength = len || 10,

@@ -15,3 +18,3 @@ base = "abcdefghijklmnopqrstuvwxyz0123456789",

for (let i = 0; i < strLength; i++) {
for (var i = 0; i < strLength; i++) {
str += base[Math.floor(baseLength * Math.random())];

@@ -26,10 +29,10 @@ }

$region: "",
speak: function(msg) {
let $msg = $("<div>" + msg + "</div>");
speak: function (msg) {
var $msg = $("<div>" + msg + "</div>");
this.$region.html($msg);
},
domListener: function() {
let observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
let $target = $(mutation.target);
domListener: function () {
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
var $target = $(mutation.target);
if ($target.hasClass("items")) {

@@ -47,3 +50,3 @@ if ($target.hasClass("dropdown-active")) {

if ($target.hasClass("active")) {
if (!!$target.attr("data-value")) {
if (!!$target.attr("data-value")) { // eslint-disable-line no-extra-boolean-cast
self.$control_input.attr(

@@ -60,2 +63,3 @@ "aria-activedescendant",

observer.observe(self.$dropdown[0], {
attributes: true,
attributeFilter: ["class"],

@@ -67,2 +71,3 @@ subtree: true,

observer.observe(self.$control[0], {
attributes: true,
attributeFilter: ["class"]

@@ -72,6 +77,7 @@ });

observer.observe(self.$control_input[0], {
attributes: true,
attributeFilter: ["value"]
});
},
setAttributes: function() {
setAttributes: function () {
this.$region.attr({

@@ -84,3 +90,3 @@ "aria-live": "assertive",

},
setStyles: function() {
setStyles: function () {
this.$region.css({

@@ -95,3 +101,3 @@ position: "absolute",

},
init: function() {
init: function () {
this.$region = $("<div>");

@@ -105,10 +111,10 @@ this.setAttributes();

this.setup = (function() {
let original = self.setup;
return function() {
this.setup = (function () {
var original = self.setup;
return function () {
original.apply(this, arguments);
let inputId = self.accessibility.helpers.randomId(),
var inputId = self.accessibility.helpers.randomId(),
listboxId = self.accessibility.helpers.randomId();
self.$control.on("keydown", function(e) {
self.$control.on("keydown", function (e) {
if (e.keyCode === KEY_RETURN) {

@@ -136,2 +142,10 @@ $(this).click();

})();
this.destroy = (function () {
var original = self.destroy;
return function () {
self.accessibility.liveRegion.$region.remove();
return original.apply(this, arguments);
};
})();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc