focus on seach, fix #429 (partialy)

This commit is contained in:
Nicolas Constant 2023-08-06 17:06:36 -04:00
parent 9cd709f44c
commit 4a34063dc8
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 5 additions and 2 deletions

View File

@ -4,7 +4,7 @@
<h3 class="panel__title">search</h3>
<form class="form-section" (ngSubmit)="onSubmit()">
<input type="text" class="form-control form-control-sm form-with-button" [(ngModel)]="searchHandle"
<input #search type="text" class="form-control form-control-sm form-with-button" [(ngModel)]="searchHandle"
name="searchHandle" placeholder="Search" autocomplete="off" />
<button class="form-button" type="submit" title="search">GO</button>
</form>

View File

@ -1,4 +1,4 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Component, OnInit, Input, Output, EventEmitter, ViewChild, ElementRef } from '@angular/core';
import { HttpErrorResponse } from '@angular/common/http';
import { MastodonWrapperService } from '../../../services/mastodon-wrapper.service';
@ -26,12 +26,15 @@ export class SearchComponent implements OnInit {
@Output() browseHashtagEvent = new EventEmitter<string>();
@Output() browseThreadEvent = new EventEmitter<OpenThreadEvent>();
@ViewChild('search') searchElement: ElementRef;
constructor(
private readonly notificationService: NotificationService,
private readonly toolsService: ToolsService,
private readonly mastodonService: MastodonWrapperService) { }
ngOnInit() {
this.searchElement.nativeElement.focus();
}
onSubmit(): boolean {