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(button group): prevent unpress in single mode button group #2860

Merged

Conversation

katebatura
Copy link
Contributor

@katebatura katebatura commented Sep 8, 2021

Please read and mark the following check list before creating a pull request:

Short description of what this resolves:

Closes #2773

In <nb-button-group> clicking 2 times on the same button don't remove the pressed state (similar to the radio group).

@katebatura katebatura requested a review from yggg September 8, 2021 15:40
@katebatura katebatura self-assigned this Sep 8, 2021
@katebatura katebatura changed the title fix(nb-button-group): button on click behavior fix(button-group): don't unpress button if not multiple group Sep 15, 2021
Comment on lines 128 to 131
if (!this.buttonGroup?.multiple && this.pressed) {
return;
}
this.pressed = !this.pressed;
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets add a comment clarifying the case when we need to prevent pressed state change. And what do you think about changing to:

Suggested change
if (!this.buttonGroup?.multiple && this.pressed) {
return;
}
this.pressed = !this.pressed;
if (this.buttonGroup?.multiple || !this.pressed) {
this.pressed = !this.pressed;
}

@yggg yggg changed the title fix(button-group): don't unpress button if not multiple group fix(button group): prevent unpress in single mode button group Sep 16, 2021
@yggg yggg merged commit 4b8a430 into akveo:master Sep 16, 2021
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

Successfully merging this pull request may close these issues.

NbButtonToggle: wrong behavior on multiple click
2 participants