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

dropdownToggle directive stops and prevents click events #1217

Closed
milichev opened this issue Nov 8, 2016 · 4 comments
Closed

dropdownToggle directive stops and prevents click events #1217

milichev opened this issue Nov 8, 2016 · 4 comments

Comments

@milichev
Copy link

milichev commented Nov 8, 2016

We need to catch click events on the document level, but dropdownToggle directive has hardcoded stopPropagation and return false (which leads to preventDefault) in its click handler. Can it be changed? Either remove both or move to if with a property like so:

  @Input() public suppressClick:boolean = true;
  
  @HostListener('click', ['$event'])
  public toggleDropdown(event:MouseEvent):boolean {
    if (this.suppressClick) {
      event.stopPropagation();
    }

    if (!this.isDisabled) {
      this.dropdown.toggle();
    }

    return !this.suppressClick;
  }
@valorkin
Copy link
Member

valorkin commented Nov 9, 2016

Hm, this is how it is in twitter bootstrap. But we can make it configurable

valorkin added a commit that referenced this issue Mar 24, 2017
fixes #1674, fixes #1749, fixes #1623, fixes #1415, fixes #802, fixes #569, fixes #530, fixes #6,
fixes #1540, fixes #1217, fixes #591, fixes #478
valorkin added a commit that referenced this issue Mar 24, 2017
fixes #1674, fixes #1749, fixes #1623, fixes #1415, fixes #802, fixes #569, fixes #530, fixes #6,
fixes #1540, fixes #1217, fixes #591, fixes #478
@H--o-l
Copy link
Contributor

H--o-l commented Nov 2, 2017

Same issue here, related to line:
https://github.com/valor-software/ngx-bootstrap/blob/development/src/dropdown/bs-dropdown-toggle.directive.ts#L44

I think the issue can be reopen :-)

@valorkin
Copy link
Member

valorkin commented Nov 2, 2017

@H--o-l need to remove it on one side, and have controversial requirements to keep it :(

@H--o-l
Copy link
Contributor

H--o-l commented Nov 2, 2017

@valorkin thanks for the quick answer !
In the meantime I opened the PR #2964 on the subject. Let me know what you think about it and if it's possible to merged it.
If it's not possible I will find another way but I think the option doesn't hurt. You let me know !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants