-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Bad UX for Checkbox Button on mobile browser #2484
Comments
By the way: from my point of view this is also confusing people on the desktop browser, especially when using the |
Totally agree! Unfortunately this is what we've got from Bootstrap CSS, you can see the same behaviour in the Bootstrap demo site: http://getbootstrap.com/docs/4.1/components/buttons/#checkbox-and-radio-buttons This steams from the fact that Bootstrap adds darker background for buttons that are focused. I agree with you that there should be more pronounced difference between checked / unchecked and hoovered. Would you mind opening an issue in https://github.com/twbs/bootstrap/issues ? |
@pkozlowski-opensource Done, I created the issue #26804. |
I have implemented a workaround that might be useful for others struggling with this. Directive@Directive({
selector: "[ngbCheckboxButtonLabel]"
})
export class NgbCheckBoxButtonLabelDirective {
private nativeElement: any;
constructor(private renderer: Renderer2, private elementRef: ElementRef) {
this.nativeElement = this.elementRef.nativeElement;
}
@HostListener("click")
onClick() {
this.renderer.addClass(this.nativeElement, "clicked");
}
@HostListener("mouseleave")
onMouseLeave() {
this.renderer.removeClass(this.nativeElement, "clicked");
}
} SCSS/* Custom adaptations for existing elements in (ng-)bootstrap. */
@import '../../node_modules/bootstrap/scss/functions';
@each $color, $value in $theme-colors {
.btn-outline-#{$color}.clicked:not(.active) {
color: $value;
background: transparent none;
}
.btn-#{$color}.clicked:not(.active) {
color: color-yiq($value);
@include gradient-bg($value);
border-color: $value;
}
} Usage<label class="btn btn-outline-primary" ngbButtonLabel ngbCheckboxButtonLabel>
<input type="checkbox" ngbButton>Button
</label> What happensThe |
I just ran into this issue as well. Vexing. The problem isn't just a focus outline issue: on mobile it stays the same "selected" color and doesn't return to the default color until you touch elsewhere on the screen. |
Buttons were removed in v13 → https://ng-bootstrap.github.io/releases/12.x/#/components/buttons/overview |
Bug description:
Using the checkbox buttons on a mobile browser (Chrome Browser 67.0.3396.87 on Android) if you uncheck/check a button it will not show the proper styling as it seems to be still hovered.
This is resulting in really bad UX due to the fact that for the overall user the button still seems to be unchecked.
You can see in the below screenshot the most right button is checked, but still showing the unchecked styling:
Link to minimally-working plunker that reproduces the issue:
You can check this by simply accessing the demo here using a mobile browser:
https://ng-bootstrap.github.io/#/components/accordion/examples
Version of Angular, ng-bootstrap, and Bootstrap:
Angular: 6.0.6
ng-bootstrap: 2.1.2
Bootstrap: 4.1.0
The text was updated successfully, but these errors were encountered: