Improve keyboard navigation

This commit is contained in:
Geomitron
2024-07-10 23:25:01 -05:00
parent 0c8b20c3e9
commit c698e6bb63
3 changed files with 5 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
<td>
<input type="checkbox" class="checkbox" (click)="$event.stopPropagation()" [(ngModel)]="selected" />
<input type="checkbox" class="checkbox" (click)="$event.stopPropagation()" (focus)="rowFocused.emit()" [(ngModel)]="selected" />
</td>
<td>
<span *ngIf="song.length > 1" class="rounded-sm bg-accent text-accent-content px-1 mr-1 font-bold">{{ song.length }}</span> {{ song[0].name }}

View File

@@ -1,4 +1,4 @@
import { Component, Input, OnInit } from '@angular/core'
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
import { ChartData } from '../../../../../../src-shared/interfaces/search.interface'
import { SelectionService } from '../../../../core/services/selection.service'
@@ -10,6 +10,8 @@ import { SelectionService } from '../../../../core/services/selection.service'
export class ResultTableRowComponent implements OnInit {
@Input() song: ChartData[]
@Output() rowFocused: EventEmitter<string> = new EventEmitter()
constructor(private selectionService: SelectionService) { }
ngOnInit() {

View File

@@ -31,6 +31,7 @@
<tr
app-result-table-row
(click)="onRowClicked(song)"
(rowFocused)="onRowClicked(song)"
[class.!bg-neutral]="activeSong === song"
[class.!text-neutral-content]="activeSong === song"
[song]="song"></tr>