blob: 0e959e899e95fee1e25d0e682a68c2d4626c652c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import { confirmAction } from './confirm_action';
function confirmViaGlModal(message, element) {
const { confirmBtnVariant, title, isHtmlMessage } = element.dataset;
const screenReaderText =
element.querySelector('.gl-sr-only')?.textContent ||
element.querySelector('.sr-only')?.textContent ||
element.getAttribute('aria-label');
const config = {
...(screenReaderText && { primaryBtnText: screenReaderText }),
...(confirmBtnVariant && { primaryBtnVariant: confirmBtnVariant }),
...(title && { title }),
...(isHtmlMessage && { modalHtmlMessage: message }),
};
return confirmAction(message, config);
}
export { confirmAction, confirmViaGlModal };
|