mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
fix focus modal lang
This commit is contained in:
parent
80736d111f
commit
cf93f5637c
@ -36,7 +36,7 @@
|
||||
id="close_dialog{{ idSuffix }}"
|
||||
class="button cancel-button-reject pull-right img-marged-left has-no-border"
|
||||
lang="{{ currentLang }}"
|
||||
(click)="focusOnCancelButton()"
|
||||
(click)="closeModalAndFocusOnButtonToOpen()"
|
||||
>
|
||||
{{ 'SENTENCES.Close' | translate }}
|
||||
<img class="icon" src="assets/icons/x_blue.svg" />
|
||||
|
@ -5,6 +5,7 @@ import { LanguageService } from '../../../../core/services/language.service';
|
||||
import { StorageService } from '../../../../core/services/storage.service';
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
import { PollService } from '../../../../core/services/poll.service';
|
||||
import { environment } from '../../../../../environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'app-language-selector',
|
||||
@ -38,16 +39,17 @@ export class LanguageSelectorComponent implements OnInit {
|
||||
this.language_to_apply = '' + this.currentLang;
|
||||
}
|
||||
|
||||
setLang(newlang: string = 'fr'): void {
|
||||
setLang(newlang: string = environment.defaultLanguage): void {
|
||||
this.currentLang = newlang;
|
||||
this.languageService.setLanguage(newlang);
|
||||
this.storageService.language = this.currentLang;
|
||||
this.pollService.updateTitle();
|
||||
}
|
||||
|
||||
focusOnCancelButton() {
|
||||
closeModalAndFocusOnButtonToOpen() {
|
||||
this.display_lang_dialog = false;
|
||||
let buttonClose = this.document.querySelector('#display_cancel_popup_button');
|
||||
this.cd.detectChanges();
|
||||
let buttonClose = this.document.querySelector('#lang_button_popup');
|
||||
if (buttonClose) {
|
||||
buttonClose.focus();
|
||||
}
|
||||
@ -71,6 +73,7 @@ export class LanguageSelectorComponent implements OnInit {
|
||||
applyLangAndClosePopup() {
|
||||
this.setLang(this.language_to_apply);
|
||||
this.display_lang_dialog = false;
|
||||
this.cd.detectChanges();
|
||||
let elem = this.document.querySelector('#lang_button_popup');
|
||||
if (elem) {
|
||||
elem.focus();
|
||||
|
Loading…
Reference in New Issue
Block a user