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

[Outreachy Task Submission] Keyboard Support For Posts Bulk Actions #961

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div
class="post"
*ngIf="post"
(click)="postClicked($event)"
(click)="$event.stopPropagation(); postClicked()"
[ngStyle]="{ '--color': post.color || 'var(--color-neutral-100)' }"
[ngClass]="{
'post--feed': feedView,
Expand All @@ -10,7 +10,11 @@
>
<div class="post__head">
<ng-container *ngIf="selectable">
<mat-checkbox [(ngModel)]="isChecked"></mat-checkbox>
<mat-checkbox
[checked]="isChecked"
(keydown.enter)="$event.preventDefault(); postClicked()"
(keydown.Space)="$event.preventDefault(); postClicked()"
></mat-checkbox>
</ng-container>
<app-post-head
[post]="post"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ export class PostPreviewComponent implements OnInit, OnChanges {
this.details.next(true);
}

public postClicked(event: MouseEvent): void {
public postClicked(): void {
if (this.selectable) {
event.stopPropagation();
this.isChecked = !this.isChecked;
this.selected.emit(this.isChecked);
}
Expand Down
Loading