Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

md-select: search does not work when you type the first letter of any other language #7730

@mihrich

Description

@mihrich

Hello Boys!

The specialist said that the problem could be here:

var searchStr = '';
var clearSearchTimeout, optNodes, optText;
var CLEAR_SEARCH_AFTER = 300;
self.optNodeForKeyboardSearch = function(e) {
  clearSearchTimeout && clearTimeout(clearSearchTimeout);
  clearSearchTimeout = setTimeout(function() {
    clearSearchTimeout = undefined;
    searchStr = '';
    optText = undefined;
    optNodes = undefined;
  }, CLEAR_SEARCH_AFTER);
  searchStr += String.fromCharCode(e.keyCode);
  var search = new RegExp('^' + searchStr, 'i');
  if (!optNodes) {
    optNodes = $element.find('md-option');
    optText = new Array(optNodes.length);
    angular.forEach(optNodes, function(el, i) {
      optText[i] = el.textContent.trim();
    });
  }
  for (var i = 0; i < optText.length; ++i) {
    if (search.test(optText[i])) {
      return optNodes[i];
    }
  }
};

Warning on the line: searchStr += String.fromCharCode(e.keyCode);

Also, experts say that the wrong key code is converted into a symbol.

Example

Version angular is 1.4.8.
Version angular materials is 1.1.0-rc1.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4: minorMinor issues. May not be fixed without community contributions.has: Pull RequestA PR has been created to address this issueresolution: fixed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions