| 
1 | 1 | /*!  | 
2 |  | - * Materialize v1.0.0-rc.2 (http://materializecss.com)  | 
 | 2 | + * Materialize v1.0.0 (http://materializecss.com)  | 
3 | 3 |  * Copyright 2014-2017 Materialize  | 
4 | 4 |  * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)  | 
5 | 5 |  */  | 
@@ -1084,6 +1084,8 @@ if (typeof define === 'function' && define.amd) {  | 
1084 | 1084 |   exports.default = M;  | 
1085 | 1085 | }  | 
1086 | 1086 | 
 
  | 
 | 1087 | +M.version = '1.0.0';  | 
 | 1088 | + | 
1087 | 1089 | M.keys = {  | 
1088 | 1090 |   TAB: 9,  | 
1089 | 1091 |   ENTER: 13,  | 
@@ -2507,7 +2509,11 @@ $jscomp.polyfill = function (e, r, p, m) {  | 
2507 | 2509 |           var $activatableElement = $(focusedElement).find('a, button').first();  | 
2508 | 2510 | 
 
  | 
2509 | 2511 |           // Click a or button tag if exists, otherwise click li tag  | 
2510 |  | -          !!$activatableElement.length ? $activatableElement[0].click() : focusedElement.click();  | 
 | 2512 | +          if (!!$activatableElement.length) {  | 
 | 2513 | +            $activatableElement[0].click();  | 
 | 2514 | +          } else if (!!focusedElement) {  | 
 | 2515 | +            focusedElement.click();  | 
 | 2516 | +          }  | 
2511 | 2517 | 
 
  | 
2512 | 2518 |           // Close dropdown on ESC  | 
2513 | 2519 |         } else if (e.which === M.keys.ESC && this.isOpen) {  | 
@@ -2687,8 +2693,7 @@ $jscomp.polyfill = function (e, r, p, m) {  | 
2687 | 2693 | 
 
  | 
2688 | 2694 |             // onOpenEnd callback  | 
2689 | 2695 |             if (typeof _this11.options.onOpenEnd === 'function') {  | 
2690 |  | -              var elem = anim.animatables[0].target;  | 
2691 |  | -              _this11.options.onOpenEnd.call(elem, _this11.el);  | 
 | 2696 | +              _this11.options.onOpenEnd.call(_this11, _this11.el);  | 
2692 | 2697 |             }  | 
2693 | 2698 |           }  | 
2694 | 2699 |         });  | 
@@ -2719,7 +2724,6 @@ $jscomp.polyfill = function (e, r, p, m) {  | 
2719 | 2724 | 
 
  | 
2720 | 2725 |             // onCloseEnd callback  | 
2721 | 2726 |             if (typeof _this12.options.onCloseEnd === 'function') {  | 
2722 |  | -              var elem = anim.animatables[0].target;  | 
2723 | 2727 |               _this12.options.onCloseEnd.call(_this12, _this12.el);  | 
2724 | 2728 |             }  | 
2725 | 2729 |           }  | 
@@ -2849,7 +2853,7 @@ $jscomp.polyfill = function (e, r, p, m) {  | 
2849 | 2853 | 
 
  | 
2850 | 2854 |   Dropdown._dropdowns = [];  | 
2851 | 2855 | 
 
  | 
2852 |  | -  window.M.Dropdown = Dropdown;  | 
 | 2856 | +  M.Dropdown = Dropdown;  | 
2853 | 2857 | 
 
  | 
2854 | 2858 |   if (M.jQueryLoaded) {  | 
2855 | 2859 |     M.initializeJqueryWrapper(Dropdown, 'dropdown', 'M_Dropdown');  | 
@@ -4420,7 +4424,7 @@ $jscomp.polyfill = function (e, r, p, m) {  | 
4420 | 4424 |     return Tabs;  | 
4421 | 4425 |   }(Component);  | 
4422 | 4426 | 
 
  | 
4423 |  | -  window.M.Tabs = Tabs;  | 
 | 4427 | +  M.Tabs = Tabs;  | 
4424 | 4428 | 
 
  | 
4425 | 4429 |   if (M.jQueryLoaded) {  | 
4426 | 4430 |     M.initializeJqueryWrapper(Tabs, 'tabs', 'M_Tabs');  | 
@@ -6090,7 +6094,7 @@ $jscomp.polyfill = function (e, r, p, m) {  | 
6090 | 6094 | 
 
  | 
6091 | 6095 |   Sidenav._sidenavs = [];  | 
6092 | 6096 | 
 
  | 
6093 |  | -  window.M.Sidenav = Sidenav;  | 
 | 6097 | +  M.Sidenav = Sidenav;  | 
6094 | 6098 | 
 
  | 
6095 | 6099 |   if (M.jQueryLoaded) {  | 
6096 | 6100 |     M.initializeJqueryWrapper(Sidenav, 'sidenav', 'M_Sidenav');  | 
@@ -11833,10 +11837,20 @@ $jscomp.polyfill = function (e, r, p, m) {  | 
11833 | 11837 |           // Add callback for centering selected option when dropdown content is scrollable  | 
11834 | 11838 |           dropdownOptions.onOpenEnd = function (el) {  | 
11835 | 11839 |             var selectedOption = $(_this71.dropdownOptions).find('.selected').first();  | 
11836 |  | -            if (_this71.dropdown.isScrollable && selectedOption.length) {  | 
11837 |  | -              var scrollOffset = selectedOption[0].getBoundingClientRect().top - _this71.dropdownOptions.getBoundingClientRect().top; // scroll to selected option  | 
11838 |  | -              scrollOffset -= _this71.dropdownOptions.clientHeight / 2; // center in dropdown  | 
11839 |  | -              _this71.dropdownOptions.scrollTop = scrollOffset;  | 
 | 11840 | + | 
 | 11841 | +            if (selectedOption.length) {  | 
 | 11842 | +              // Focus selected option in dropdown  | 
 | 11843 | +              M.keyDown = true;  | 
 | 11844 | +              _this71.dropdown.focusedIndex = selectedOption.index();  | 
 | 11845 | +              _this71.dropdown._focusFocusedItem();  | 
 | 11846 | +              M.keyDown = false;  | 
 | 11847 | + | 
 | 11848 | +              // Handle scrolling to selected option  | 
 | 11849 | +              if (_this71.dropdown.isScrollable) {  | 
 | 11850 | +                var scrollOffset = selectedOption[0].getBoundingClientRect().top - _this71.dropdownOptions.getBoundingClientRect().top; // scroll to selected option  | 
 | 11851 | +                scrollOffset -= _this71.dropdownOptions.clientHeight / 2; // center in dropdown  | 
 | 11852 | +                _this71.dropdownOptions.scrollTop = scrollOffset;  | 
 | 11853 | +              }  | 
11840 | 11854 |             }  | 
11841 | 11855 |           };  | 
11842 | 11856 | 
 
  | 
 | 
0 commit comments