Skip to content

Commit

Permalink
Fixed #14368 - Accordian : TextArea shortcuts are not working when us…
Browse files Browse the repository at this point in the history
…ed in Accordian Panels
  • Loading branch information
bhishman-desai committed Jan 5, 2024
1 parent 146364d commit 86bd034
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
15 changes: 12 additions & 3 deletions src/app/components/accordion/accordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { ChevronRightIcon } from 'primeng/icons/chevronright';
import { Subscription } from 'rxjs';
import { AccordionTabCloseEvent, AccordionTabOpenEvent } from './accordion.interface';
import { UniqueComponentId } from 'primeng/utils';
import { HTMLUtils } from '../utils/htmlutils';

/**
* AccordionTab is a helper component for Accordion.
Expand Down Expand Up @@ -463,8 +462,18 @@ export class Accordion implements BlockableUI, AfterContentInit, OnDestroy {
}
}

isInput(event): boolean {
const { tagName } = event.target;
return tagName?.toLowerCase() === 'input';
}

isTextArea(event): boolean {
const { tagName } = event.target;
return tagName?.toLowerCase() === 'textarea';
}

onTabArrowDownKey(event) {
if (!HTMLUtils.isInput(event) && !HTMLUtils.isTextArea(event)) {
if (!this.isInput(event) && !this.isTextArea(event)) {
const nextHeaderAction = this.findNextHeaderAction(event.target.parentElement.parentElement.parentElement);
nextHeaderAction ? this.changeFocusedTab(nextHeaderAction) : this.onTabHomeKey(event);

Expand All @@ -473,7 +482,7 @@ export class Accordion implements BlockableUI, AfterContentInit, OnDestroy {
}

onTabArrowUpKey(event) {
if (!HTMLUtils.isInput(event) && !HTMLUtils.isTextArea(event)) {
if (!this.isInput(event) && !this.isTextArea(event)) {
const prevHeaderAction = this.findPrevHeaderAction(event.target.parentElement.parentElement.parentElement);
prevHeaderAction ? this.changeFocusedTab(prevHeaderAction) : this.onTabEndKey(event);

Expand Down
11 changes: 0 additions & 11 deletions src/app/components/utils/htmlutils.ts

This file was deleted.

0 comments on commit 86bd034

Please sign in to comment.