Skip to content

Commit

Permalink
OrderList | Refactor accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Nov 17, 2023
1 parent 9794770 commit 163d40b
Show file tree
Hide file tree
Showing 49 changed files with 16,749 additions and 5,217 deletions.
14 changes: 6 additions & 8 deletions src/app/components/orderlist/orderlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,19 +641,17 @@ export class OrderList implements AfterViewChecked, AfterContentInit {
}

moveItemInArray(this.value as any[], previousIndex, currentIndex);
this.changeFocusedOptionIndex(currentIndex);
this.onReorder.emit([event.item.data]);
}
}

onListFocus(event) {
const selectedFirstItem = DomHandler.findSingle(this.listViewChild.nativeElement, '[data-p-highlight="true"]');

if (selectedFirstItem) {
const findIndex = ObjectUtils.findIndexInList(selectedFirstItem, this.listViewChild.nativeElement.children);

const focusableEl = DomHandler.findSingle(this.listViewChild.nativeElement, '[data-p-highlight="true"]') || DomHandler.findSingle(this.listViewChild.nativeElement, '[data-pc-section="item"]')
if (focusableEl) {
const findIndex = ObjectUtils.findIndexInList(focusableEl, this.listViewChild.nativeElement.children);
this.focused = true;

const index = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : selectedFirstItem ? findIndex : -1;
const index = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : focusableEl ? findIndex : -1;

this.changeFocusedOptionIndex(index);
}
Expand Down Expand Up @@ -811,7 +809,7 @@ export class OrderList implements AfterViewChecked, AfterContentInit {
const element = DomHandler.findSingle(this.listViewChild.nativeElement, `[data-pc-section="item"][id="${id}"]`);

if (element) {
element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'start' });
element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'nearest' });
}
}

Expand Down
Loading

0 comments on commit 163d40b

Please sign in to comment.