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

fix(accordion): don't submit HTML form when toggling panels #2762

Closed
wants to merge 1 commit into from
Closed

fix(accordion): don't submit HTML form when toggling panels #2762

wants to merge 1 commit into from

Conversation

pkozlowski-opensource
Copy link
Member

Fixes #2760

I've also checked all other widgets and all seems fine - only accordion was missing type="button"

@@ -116,7 +116,8 @@ export interface NgbPanelChangeEvent {
<div class="card">
<div role="tab" id="{{panel.id}}-header" [class]="'card-header ' + (panel.type ? 'bg-'+panel.type: type ? 'bg-'+type : '')">
<h5 class="mb-0">
<button class="btn btn-link" (click)="!!toggle(panel.id)" [disabled]="panel.disabled" [class.collapsed]="!panel.isOpen"
<button type="button" class="btn btn-link"
(click)="!!toggle(panel.id)" [disabled]="panel.disabled" [class.collapsed]="!panel.isOpen"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could remove the !! here as it is not needed anymore. It used to be needed when the <button> was an <a>.

Returning false to prevent default only work on <a> tag (and it is not standard, and should not be used anymore BTW).

On a button it is effect-less. Main issue here was definitely only related to the missing type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point @benouat - thnx, removed it.

Copy link
Member

@maxokorokov maxokorokov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please merge, I'll rebase on this for TS 3.1 fix

@maxokorokov maxokorokov added this to the 3.3.0 milestone Oct 5, 2018
@pkozlowski-opensource
Copy link
Member Author

@maxokorokov thnx, it is merged now.

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

Successfully merging this pull request may close these issues.

None yet

3 participants