Skip to content

Commit e9289d1

Browse files
committed
fix(Modal): exclude Poppers in aria-hidden change
Popper based components like Select or Dropdown get mounted to the DOM on the same level as Modal. Modal then on update can set aria-hidden label to true via function toggleSiblingsFromScreenReaders, which adds the label to all the elements that are siblings of the Modal, including these components.This causes the opened Popper based component to become invisible for screen readers and/or Playwright. Fix this by excluding all the Popper components from this function's behaviour.
1 parent 41fa345 commit e9289d1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • packages/react-core/src/components/Modal

packages/react-core/src/components/Modal/Modal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ class Modal extends Component<ModalProps, ModalState> {
111111
const target: HTMLElement = this.getElement(appendTo);
112112
const bodyChildren = target.children;
113113
for (const child of Array.from(bodyChildren)) {
114-
if (child.id !== this.backdropId) {
114+
const isPopperElement = child.hasAttribute('data-popper-placement');
115+
if (child.id !== this.backdropId && !isPopperElement) {
115116
hide ? child.setAttribute('aria-hidden', '' + hide) : child.removeAttribute('aria-hidden');
116117
}
117118
}

0 commit comments

Comments
 (0)