Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking on SVG inside select option causes error #940

Closed
evkw opened this issue Nov 10, 2018 · 0 comments
Closed

Clicking on SVG inside select option causes error #940

evkw opened this issue Nov 10, 2018 · 0 comments

Comments

@evkw
Copy link

evkw commented Nov 10, 2018

Describe the bug
If an SVG is clicked on anywhere inside an ng-select option. The following error is observed.

ERROR
Error: target.className.includes is not a function

Reproducbile example
https://stackblitz.com/edit/ng-select-nk5spz

To Reproduce
Steps to reproduce the behavior (if example is not provided):

  1. Go to linked stackblitz
  2. Add any option from the multi-select
  3. Click on the large yellow circle SVG
  4. See error

Expected behavior
No error occurs.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 70.0.3538.77

Additional context
Issue is in handleMousedown method of ng-select.component.ts. It assume the target is HTMLElement which has a classList of string. When an SVGElement is clicked, it also has classList, but its an object that doesnt include 'includes' in its prototype.

AndersTornkvist added a commit to AndersTornkvist/ng-select that referenced this issue Dec 31, 2018
* remotes/main/master: (25 commits)
  chore(release): 2.13.3
  fix: keep selected items while bindValue is incorrect closes ng-select#993
  chore(release): 2.13.2
  fix: appended dropdown position (ng-select#957)
  chore(release): 2.13.1
  fix: map selected items while source changed closes ng-select#980, ng-select#977, ng-select#959
  chore(release): 2.13.0
  [fix] - $event.path does not work in Safari and Firefox. Replace with $event.composedPath(). (ng-select#968)
  feat(templates): add searchTerm to header and footer (ng-select#961)
  chore(release): 2.12.1
  chore: include scss with package closes ng-select#909
  fix: use classList instead of className closes ng-select#940
  add aria-selected attribute on selected items (ng-select#936)
  fix: handler mousedown for clear event when used animation library (ng-select#931)
  chore(release): 2.12.0
  feat(autofocus): focus if attribute is present (ng-select#924)
  feat(isOpen): treat undefined value as default behaviour closes ng-select#816
  feat: allow to customise clear icon fixes ng-select#835
  chore(demo): fix virtual scroll example closes ng-select#921
  fix: keep items order while mapping selected options fixes ng-select#907
  ...
NickMele pushed a commit to NickMele/ng-select that referenced this issue Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant