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.

select: SyntaxError: Invalid regular expression: nothing to repeat #11854

@psamim

Description

@psamim

Bug

CodePen and steps to reproduce the issue:

CodePen Demo which demonstrates the issue:

https://codepen.io/psamim/pen/mdyNEZx

Detailed Reproduction Steps:

  1. Have a select with options starting with + like +44
  2. Open the options menu
  3. Enter +44 by keyboard to search through options

What is the expected behavior?

It should go to the option starting with +44

What is the current behavior?

It crashes with error below:

Uncaught SyntaxError: Invalid regular expression: /^+/: Nothing to repeat
    at new RegExp (<anonymous>)
    at SelectMenuController.self.optNodeForKeyboardSearch (app-bundle.js:11)
    at HTMLElement.onMenuKeyDown (app-bundle.js:11)
    at defaultHandlerWrapper (app-bundle.js:5)
    at HTMLElement.eventHandler (app-bundle.js:5)
    at HTMLElement.r (helpers.ts:77)

What is the use-case or motivation for changing an existing behavior?

This is a bug. The entered value by the user should be sanitized before creating a RexExp.

Which versions of AngularJS, Material, OS, and browsers are affected?

  • AngularJS: 1.x
  • AngularJS Material: 1.x
  • OS: All
  • Browsers: All

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions