Skip to content

Commit

Permalink
fix(typeahead): use inline style for live element
Browse files Browse the repository at this point in the history
Use inline style instead of the bootstrap class for the live element
to support the usage of the component in the shadow DOM.
Fixes ng-bootstrap#4560
  • Loading branch information
Jeremy CHOISY committed Nov 10, 2023
1 parent 3093400 commit 870bb1d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/util/accessibility/live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ function getLiveElement(document: any, lazyCreate = false): HTMLElement | null {
element.setAttribute('aria-live', 'polite');
element.setAttribute('aria-atomic', 'true');

element.classList.add('visually-hidden');
// Visually hide the element
element.style.position = 'absolute';
element.style.width = '1px';
element.style.height = '1px';
element.style.padding = '0';
element.style.margin = '-1px';
element.style.overflow = 'hidden';
element.style.clipPath = 'inset(100%)';
element.style.whiteSpace = 'nowrap';
element.style.border = '0';

document.body.appendChild(element);
}
Expand Down

0 comments on commit 870bb1d

Please sign in to comment.