UNPKG

@shopify/polaris

Version:

Shopify’s admin product component library

22 lines (19 loc) 593 B
'use strict'; 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)); } } exports.setActivatorAttributes = setActivatorAttributes;