UNPKG

@shopify/polaris

Version:

Shopify’s admin product component library

20 lines (18 loc) 556 B
function setActivatorAttributes(activator, { id, active = false, ariaHaspopup, activatorDisabled = false }) { if (!activatorDisabled) { activator.tabIndex = activator.tabIndex || 0; } activator.setAttribute('aria-controls', id); activator.setAttribute('aria-owns', id); activator.setAttribute('aria-expanded', String(active)); activator.setAttribute('data-state', active ? 'open' : 'closed'); if (ariaHaspopup != null) { activator.setAttribute('aria-haspopup', String(ariaHaspopup)); } } export { setActivatorAttributes };