Fix selection transformer focusing on element on each refresh (#6037)

https://community.openproject.com/wp/26575
https://community.openproject.com/wp/26609

[ci skip]
pull/6043/head
Oliver Günther 7 years ago committed by GitHub
parent d90513b968
commit 27ee0fafd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      frontend/app/components/wp-fast-table/handlers/state/selection-transformer.ts

@ -12,6 +12,11 @@ export class SelectionTransformer {
public states:States;
public FocusHelper:any;
// When first entering the page, the user
// wants to scroll to the focused work package in the table.
// We only want to do this once, so remember when we did the first focus
private hasFocusedOnElement = false;
constructor(table:WorkPackageTable) {
injectorBridge(this);
@ -24,10 +29,13 @@ export class SelectionTransformer {
return;
}
const element = locateTableRow(singleSelection);
if (element.length) {
element[0].scrollIntoView();
this.FocusHelper.focusElement(element, true);
if (!this.hasFocusedOnElement) {
this.hasFocusedOnElement = true;
const element = locateTableRow(singleSelection);
if (element.length) {
element[0].scrollIntoView();
this.FocusHelper.focusElement(element, true);
}
}
});

Loading…
Cancel
Save