(props: SeparatorProps)
| 35 | * e.g. groups of menu items or sections of a page. |
| 36 | */ |
| 37 | export function useSeparator(props: SeparatorProps): SeparatorAria { |
| 38 | let domProps = filterDOMProps(props, {labelable: true}); |
| 39 | let ariaOrientation; |
| 40 | // if orientation is horizontal, aria-orientation default is horizontal, so we leave it undefined |
| 41 | // if it's vertical, we need to specify it |
| 42 | if (props.orientation === 'vertical') { |
| 43 | ariaOrientation = 'vertical'; |
| 44 | } |
| 45 | // hr elements implicitly have role = separator and a horizontal orientation |
| 46 | if (props.elementType !== 'hr') { |
| 47 | return { |
| 48 | separatorProps: { |
| 49 | ...domProps, |
| 50 | role: 'separator', |
| 51 | 'aria-orientation': ariaOrientation |
| 52 | } |
| 53 | }; |
| 54 | } |
| 55 | return {separatorProps: domProps}; |
| 56 | } |
no test coverage detected