@atlaskit/popup
Version:
A popup displays brief content in an overlay.
13 lines • 391 B
JavaScript
/**
* Narrows a popup `role` to one that `getAriaForTrigger` accepts.
*
* Tooltip-family roles and no role give `undefined`, so the trigger gets no `aria-haspopup`.
*/
export function getTriggerRole({
role
}) {
if (role === 'dialog' || role === 'alertdialog' || role === 'menu' || role === 'listbox' || role === 'tree' || role === 'grid') {
return role;
}
return undefined;
}