Skip to content

Commit

Permalink
fix(ListBoxMenuItem): ensure border-subtle renders correct value
Browse files Browse the repository at this point in the history
  • Loading branch information
tw15egan committed May 25, 2023
1 parent b8701c9 commit 139979b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/react/src/components/ListBox/ListBoxMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React, { ForwardedRef, useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import { usePrefix } from '../../internal/usePrefix';
import { ForwardRefReturn, ReactAttr } from '../../types/common';
import { Layer } from '../Layer';

function useIsTruncated(ref) {
const [isTruncated, setIsTruncated] = useState(false);
Expand Down Expand Up @@ -37,6 +38,7 @@ export interface ListBoxMenuItemProps extends ReactAttr<HTMLDivElement> {
export type ListBoxMenuItemForwardedRef =
| (ForwardedRef<HTMLDivElement> & {
menuItemOptionRef?: React.Ref<HTMLDivElement>;
Layer: HTMLDivElement;
})
| null;

Expand Down Expand Up @@ -69,11 +71,13 @@ const ListBoxMenuItem = React.forwardRef<HTMLDivElement, ListBoxMenuItemProps>(
className={className}
title={isTruncated ? title : undefined}
tabIndex={-1}>
<div
className={`${prefix}--list-box__menu-item__option`}
ref={forwardedRef?.menuItemOptionRef || ref}>
{children}
</div>
<Layer>
<div
className={`${prefix}--list-box__menu-item__option`}
ref={forwardedRef?.menuItemOptionRef || ref}>
{children}
</div>
</Layer>
</div>
);
}
Expand Down

0 comments on commit 139979b

Please sign in to comment.