mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-3899] Viewer thumbnails cannot be accessed by keyboard (#6150)
* accessibility * add thumb focus * close thumbs list event * fix eventbus listener * rename parameter * track previous focused element * implement FocusKeyManager * fix getGlobalEventBus is deprecated * keyboard navigation * set tabindex * setActiveItem on list change * update test
This commit is contained in:
@@ -15,28 +15,34 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, ElementRef, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { FocusableOption } from '@angular/cdk/a11y';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-pdf-thumb',
|
||||
templateUrl: './pdf-viewer-thumb.component.html',
|
||||
encapsulation: ViewEncapsulation.None
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
host: { tabindex: '0'}
|
||||
})
|
||||
export class PdfThumbComponent implements OnInit {
|
||||
export class PdfThumbComponent implements OnInit, FocusableOption {
|
||||
|
||||
@Input()
|
||||
page: any = null;
|
||||
|
||||
image$: Promise<string>;
|
||||
|
||||
constructor(private sanitizer: DomSanitizer) {
|
||||
constructor(private sanitizer: DomSanitizer, private element: ElementRef) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.image$ = this.page.getPage().then((page) => this.getThumb(page));
|
||||
}
|
||||
|
||||
focus() {
|
||||
this.element.nativeElement.focus();
|
||||
}
|
||||
|
||||
private getThumb(page): Promise<string> {
|
||||
const viewport = page.getViewport({ scale: 1 });
|
||||
|
||||
|
Reference in New Issue
Block a user