UNPKG

@scania/tegel

Version:
77 lines (74 loc) 2.09 kB
import { i as inheritAttributes } from './p-3fe9cbbf.js'; /** * List of available ARIA attributes + `role`. * Removed deprecated attributes. * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes */ const ariaAttributes = [ 'role', 'aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-braillelabel', 'aria-brailleroledescription', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colindextext', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-description', 'aria-details', 'aria-disabled', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowindextext', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', ]; /** * Returns an array of aria attributes that should be copied from * the shadow host element to a target within the light DOM. * @param el The element that the attributes should be copied from. * @param ignoreList The list of aria-attributes to ignore reflecting and removing from the host. * Use this in instances where we manually specify aria attributes on the `<Host>` element. */ const inheritAriaAttributes = (el, ignoreList) => { let attributesToInherit = ariaAttributes; if (ignoreList && ignoreList.length > 0) { attributesToInherit = attributesToInherit.filter((attr) => !ignoreList.includes(attr)); } return inheritAttributes(el, attributesToInherit); }; export { inheritAriaAttributes as i };