@@ -3662,11 +3662,6 @@ var Choices = /** @class */ (function () {
36623662 _this . input . focus ( ) ;
36633663 }
36643664 _this . passedElement . triggerEvent ( EventType . showDropdown ) ;
3665- var activeElement = _this . choiceList . element . querySelector ( getClassNamesSelector ( _this . config . classNames . selectedState ) ) ;
3666- if ( activeElement !== null && ! isScrolledIntoView ( activeElement , _this . choiceList . element ) ) {
3667- // We use the native scrollIntoView function instead of choiceList.scrollToChildElement to avoid animated scroll.
3668- activeElement . scrollIntoView ( ) ;
3669- }
36703665 } ) ;
36713666 return this ;
36723667 } ;
@@ -3675,7 +3670,6 @@ var Choices = /** @class */ (function () {
36753670 if ( ! this . dropdown . isActive ) {
36763671 return this ;
36773672 }
3678- this . _removeHighlightedChoices ( ) ;
36793673 requestAnimationFrame ( function ( ) {
36803674 _this . dropdown . hide ( ) ;
36813675 _this . containerOuter . close ( ) ;
@@ -4248,7 +4242,7 @@ var Choices = /** @class */ (function () {
42484242 if ( ! items . length || ! this . config . removeItems || ! this . config . removeItemButton ) {
42494243 return ;
42504244 }
4251- var id = element && parseDataSetId ( element . closest ( '[data-id]' ) ) ;
4245+ var id = element && parseDataSetId ( element . parentElement ) ;
42524246 var itemToRemove = id && items . find ( function ( item ) { return item . id === id ; } ) ;
42534247 if ( ! itemToRemove ) {
42544248 return ;
@@ -4828,7 +4822,7 @@ var Choices = /** @class */ (function () {
48284822 */
48294823 Choices . prototype . _onMouseDown = function ( event ) {
48304824 var target = event . target ;
4831- if ( ! ( target instanceof Element ) ) {
4825+ if ( ! ( target instanceof HTMLElement ) ) {
48324826 return ;
48334827 }
48344828 // If we have our mouse down on the scrollbar and are on IE11...
@@ -4970,18 +4964,6 @@ var Choices = /** @class */ (function () {
49704964 Choices . prototype . _onInvalid = function ( ) {
49714965 this . containerOuter . addInvalidState ( ) ;
49724966 } ;
4973- /**
4974- * Removes any highlighted choice options
4975- */
4976- Choices . prototype . _removeHighlightedChoices = function ( ) {
4977- var highlightedState = this . config . classNames . highlightedState ;
4978- var highlightedChoices = Array . from ( this . dropdown . element . querySelectorAll ( getClassNamesSelector ( highlightedState ) ) ) ;
4979- // Remove any highlighted choices
4980- highlightedChoices . forEach ( function ( choice ) {
4981- removeClassesFromElement ( choice , highlightedState ) ;
4982- choice . setAttribute ( 'aria-selected' , 'false' ) ;
4983- } ) ;
4984- } ;
49854967 Choices . prototype . _highlightChoice = function ( el ) {
49864968 if ( el === void 0 ) { el = null ; }
49874969 var choices = Array . from ( this . dropdown . element . querySelectorAll ( selectableChoiceIdentifier ) ) ;
@@ -4990,7 +4972,12 @@ var Choices = /** @class */ (function () {
49904972 }
49914973 var passedEl = el ;
49924974 var highlightedState = this . config . classNames . highlightedState ;
4993- this . _removeHighlightedChoices ( ) ;
4975+ var highlightedChoices = Array . from ( this . dropdown . element . querySelectorAll ( getClassNamesSelector ( highlightedState ) ) ) ;
4976+ // Remove any highlighted choices
4977+ highlightedChoices . forEach ( function ( choice ) {
4978+ removeClassesFromElement ( choice , highlightedState ) ;
4979+ choice . setAttribute ( 'aria-selected' , 'false' ) ;
4980+ } ) ;
49944981 if ( passedEl ) {
49954982 this . _highlightPosition = choices . indexOf ( passedEl ) ;
49964983 }
0 commit comments