Skip to content

Commit d1d9e7e

Browse files
mozziusclaude
andcommitted
keep right chevrons trailing in web menu items
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 21f2d11 commit d1d9e7e

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎src/components/Menu/index.web.tsx‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {atoms as a, flatten, flattenToCSS, useTheme, utils, web} from '#/alf'
1717
import type * as Dialog from '#/components/Dialog'
1818
import {useInteractionState} from '#/components/hooks/useInteractionState'
1919
import {Check_Stroke3_Corner0_Rounded as Check} from '#/components/icons/Check'
20+
import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRight} from '#/components/icons/Chevron'
2021
import {
2122
Context,
2223
ItemContext,
@@ -357,14 +358,19 @@ export function Item({
357358
/**
358359
* Puts an item's icons on the leading side, whatever order they're written
359360
* in, like Android's menus. A radio item leads with its check instead, and its
360-
* icons trail.
361+
* icons trail. A right chevron means the item opens more options, so it
362+
* trails like Android's submenu arrow.
361363
*/
362364
function arrangeItemContent(children: React.ReactNode) {
363365
let radio: React.ReactElement<{selected: boolean}> | undefined
364366
const icons: React.ReactNode[] = []
365367
const rest: React.ReactNode[] = []
366368
for (const child of flattenReactChildren(children)) {
367-
if (isValidElement(child) && child.type === ItemIcon) {
369+
if (
370+
isValidElement<ItemIconProps>(child) &&
371+
child.type === ItemIcon &&
372+
child.props.icon !== ChevronRight
373+
) {
368374
icons.push(child)
369375
} else if (
370376
isValidElement<{selected: boolean}>(child) &&
@@ -404,7 +410,8 @@ export function ItemText({children, style}: ItemTextProps) {
404410
}
405411

406412
/**
407-
* `position` has no effect: icons always lead, or trail in radio items.
413+
* `position` has no effect: icons always lead, or trail in radio items. A
414+
* right chevron always trails.
408415
*/
409416
export function ItemIcon({icon: Comp, fill}: ItemIconProps) {
410417
const t = useTheme()

‎src/components/Menu/types.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export type ItemIconProps = React.PropsWithChildren<{
163163
icon: React.ComponentType<SVGIconProps>
164164
/**
165165
* Has no effect. On web, `Item` puts icons on the leading side, or the
166-
* trailing side in radio items. On native, sheet menus show them where
166+
* trailing side in radio items, and a right chevron always trails. On native, sheet menus show them where
167167
* they're written, and inline menus where the platform puts them.
168168
*/
169169
position?: 'left' | 'right'

0 commit comments

Comments
 (0)