diff --git a/dist/bundle.js b/dist/bundle.js index 87a2236..d3e91b5 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -111,7 +111,9 @@ var MissPlete = if (_this.ul) { // dropdown visible? switch (event.keyCode) { + case 9: case 13: + event.preventDefault(); _this.selectFn(_this.scoredOptions[_this.highlightedIndex]); break; case 27: @@ -200,6 +202,8 @@ var MissPlete = this.input.parentNode.insertBefore(newContainer, this.input.nextSibling); this.container = newContainer; this.ul = newUl; + + this.changeHighlightedOption(0); } } }, { diff --git a/src/MissPlete.js b/src/MissPlete.js index 7799703..c33bf1a 100644 --- a/src/MissPlete.js +++ b/src/MissPlete.js @@ -31,7 +31,9 @@ class MissPlete { this.input.addEventListener('keydown', event => { if (this.ul) { // dropdown visible? switch (event.keyCode) { + case 9: case 13: + event.preventDefault(); this.selectFn(this.scoredOptions[this.highlightedIndex]); break; case 27: // Esc @@ -155,6 +157,8 @@ class MissPlete { this.input.parentNode.insertBefore(newContainer, this.input.nextSibling); this.container = newContainer; this.ul = newUl; + + this.changeHighlightedOption(0); } } diff --git a/website/bundle.js b/website/bundle.js index a789a86..198a9a8 100644 --- a/website/bundle.js +++ b/website/bundle.js @@ -1,4 +1,5 @@ -!function(t){function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){e(1),t.exports=e(192)},function(t,n,e){(function(t){"use strict";if(e(2),e(189),t._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");t._babelPolyfill=!0}).call(n,function(){return this}())},function(t,n,e){"use strict";e(3),e(36),e(42),e(44),e(46),e(48),e(50),e(52),e(53),e(54),e(55),e(56),e(57),e(58),e(59),e(60),e(61),e(62),e(63),e(66),e(67),e(68),e(70),e(71),e(72),e(73),e(74),e(75),e(76),e(78),e(79),e(80),e(82),e(83),e(84),e(86),e(87),e(88),e(89),e(90),e(91),e(92),e(93),e(94),e(95),e(96),e(97),e(98),e(99),e(104),e(105),e(109),e(110),e(112),e(113),e(118),e(119),e(122),e(124),e(126),e(128),e(129),e(130),e(132),e(133),e(135),e(136),e(137),e(138),e(145),e(148),e(149),e(151),e(152),e(153),e(154),e(155),e(156),e(157),e(158),e(159),e(160),e(161),e(162),e(164),e(165),e(166),e(167),e(168),e(169),e(171),e(172),e(173),e(174),e(176),e(177),e(179),e(180),e(182),e(183),e(184),e(187),e(188),t.exports=e(7)},function(t,n,e){"use strict";var r,i=e(4),o=e(5),u=e(10),a=e(9),c=e(16),s=e(17),f=e(19),l=e(20),h=e(21),p=e(11),v=e(22),d=e(15),g=e(18),y=e(23),m=e(25),S=e(27),b=e(28),w=e(29),x=e(26),M=e(13)("__proto__"),E=e(30),O=e(35)(!1),I=Object.prototype,P=Array.prototype,A=P.slice,N=P.join,_=i.setDesc,F=i.getDesc,L=i.setDescs,C={};u||(r=!p(function(){return 7!=_(s("div"),"a",{get:function(){return 7}}).a}),i.setDesc=function(t,n,e){if(r)try{return _(t,n,e)}catch(i){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(v(t)[n]=e.value),t},i.getDesc=function(t,n){if(r)try{return F(t,n)}catch(e){}return f(t,n)?a(!I.propertyIsEnumerable.call(t,n),t[n]):void 0},i.setDescs=L=function(t,n){v(t);for(var e,r=i.getKeys(n),o=r.length,u=0;o>u;)i.setDesc(t,e=r[u++],n[e]);return t}),o(o.S+o.F*!u,"Object",{getOwnPropertyDescriptor:i.getDesc,defineProperty:i.setDesc,defineProperties:L});var T="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),j=T.concat("length","prototype"),R=T.length,k=function(){var t,n=s("iframe"),e=R,r=">";for(n.style.display="none",c.appendChild(n),n.src="javascript:",t=n.contentWindow.document,t.open(),t.write("