Skip to content

Commit

Permalink
updated prop name for alt trigger rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
KitoC committed Oct 2, 2024
1 parent 6046c59 commit 4d47632
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
18 changes: 7 additions & 11 deletions lib/components/ActionsMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export const ActionsMenuBody = ({
direction = "right-start",
menuWidth,
customTriggerComponent,
CustomTriggerComponent,
renderTrigger,
children,
ariaLabel = "Options Menu",
onTriggerFocus,
Expand Down Expand Up @@ -351,6 +351,10 @@ export const ActionsMenuBody = ({
</Control>
);

if (renderTrigger) {
triggerComponent = renderTrigger(triggerProps);
}

if (customTriggerComponent) {
triggerComponent = (
<div role="button" {...triggerProps}>
Expand All @@ -359,14 +363,6 @@ export const ActionsMenuBody = ({
);
}

/**
* Better to use CustomTriggerComponent for aria reasons.
* But we have to pass in a component wrapped in React.forwardRef so that the ref gets passed properly.
*/
if (CustomTriggerComponent) {
triggerComponent = <CustomTriggerComponent {...triggerProps} />;
}

const value = useMemo(
() => ({
id,
Expand Down Expand Up @@ -463,7 +459,7 @@ ActionsMenuBody.propTypes = {
menuRightPosition: PropTypes.string,
menuWidth: PropTypes.string,
customTriggerComponent: PropTypes.node,
CustomTriggerComponent: PropTypes.object,
renderTrigger: PropTypes.func,
"data-testid": PropTypes.string,
children: PropTypes.oneOfType([
PropTypes.node,
Expand Down Expand Up @@ -516,7 +512,7 @@ ActionsMenu.propTypes = {
"right-end"
]),
customTriggerComponent: PropTypes.node,
CustomTriggerComponent: PropTypes.object,
renderTrigger: PropTypes.func,
closeOnClick: PropTypes.bool,
children: PropTypes.oneOfType([
PropTypes.node,
Expand Down
5 changes: 2 additions & 3 deletions lib/components/Tabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,9 @@ const Tabs = ({ tabsList }) => {

<ActionsMenu
direction="bottom-end"
CustomTriggerComponent={React.forwardRef((props, ref) => (
renderTrigger={(props) => (
<ShowMoreButton
{...props}
ref={ref}
showMoreVisible={showMoreTabsList.length}
id="show-more-button"
className={showMoreItemActive && "hasActive"}
Expand All @@ -237,7 +236,7 @@ const Tabs = ({ tabsList }) => {
/>
</FlexItem>
</ShowMoreButton>
))}
)}
closeOnClick
>
<ShowMoreTabs>
Expand Down

0 comments on commit 4d47632

Please sign in to comment.