Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4b611e8
feat(DropdownMenu): One menu component for actions and tab overflow
talissoncosta Nov 25, 2026
5cde334
refactor(OverflowNav): Use DropdownMenu for the nav overflow
talissoncosta Nov 25, 2026
43833ff
fix(Integrations): Give each configured integration's menu its own name
talissoncosta Nov 25, 2026
654ed47
refactor(DropdownMenu): Take an item's icon as a child
talissoncosta Nov 26, 2026
dccd1b1
refactor(DropdownMenu): Stretch link rows with a grid, not a child rule
talissoncosta Nov 26, 2026
ce1c2ee
refactor(DropdownMenu): Let states and the sheet set variables the el…
talissoncosta Nov 26, 2026
fe7010e
fix(Popover): Keep clicks from reaching the row, close on route change
talissoncosta Nov 26, 2026
1859930
test(E2E): Open feature drawer tabs by role, from More tabs when over…
talissoncosta Nov 26, 2026
db915a1
feat(DropdownMenu): Render overflowed nav links as menu rows
talissoncosta Nov 26, 2026
2757326
refactor(Nav): Keep ionicons out of the overflow menus
talissoncosta Nov 26, 2026
7e0ff40
refactor(DropdownMenu): Simplify the menu styles
talissoncosta Nov 26, 2026
be510da
fix(DropdownMenu): Keep a nav link's id and data-test when it overflo…
talissoncosta Nov 26, 2026
22adc4d
fix(Nav): Stop filling the open paths of stroke icons
talissoncosta Nov 26, 2026
b4e0acf
refactor(Popover): Inline the stopPropagation handlers
talissoncosta Nov 26, 2026
9ed745c
refactor(DropdownMenu): Trim the props to a generic menu API
talissoncosta Nov 27, 2026
c0c2514
refactor(DropdownMenu): Reuse the tab and label helpers
talissoncosta Nov 27, 2026
7f2fdb4
refactor(DropdownMenu): Share the row layout, keep trigger handlers, …
talissoncosta Nov 27, 2026
9186dd1
fix(DropdownMenu): Announce the popup as a menu and keep one Tab stop
talissoncosta Nov 27, 2026
4bc9fd6
refactor(DropdownMenu): Find menu rows by role
talissoncosta Nov 27, 2026
edbe357
fix(DropdownMenu): Wait for the menu role in the stories
talissoncosta Nov 27, 2026
84fa2e4
fix(DropdownMenu): Let Space choose a link row
talissoncosta Nov 27, 2026
d378047
chore(DropdownMenu): Trim the comments
talissoncosta Nov 27, 2026
4a9511c
refactor(Popover): Close on back or forward without the router
talissoncosta Nov 27, 2026
e37e6ed
style(DropdownMenu): Use 36px rows on desktop
talissoncosta Nov 27, 2026
421f69a
refactor(DropdownMenu): Use BodyText for the item description
talissoncosta Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 81 additions & 26 deletions frontend/documentation/components/DropdownMenu.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,100 @@
import React from 'react'
import React, { useState } from 'react'
import type { Meta, StoryObj } from 'storybook'
import { screen, userEvent, within } from 'storybook/test'

import DropdownMenu from 'components/base/DropdownMenu'
import DropdownMenu, { DropdownMenuItem } from 'components/base/DropdownMenu'
import Button from 'components/base/forms/Button'
import Icon from 'components/icons/Icon'

const meta: Meta = {
const meta: Meta<typeof DropdownMenu> = {
component: DropdownMenu,
parameters: {
docs: { story: { height: '260px' } },
docs: { story: { height: '320px' } },
layout: 'centered',
},
title: 'Components/Data Display/DropdownMenu',
}
export default meta

type Story = StoryObj
type Story = StoryObj<typeof DropdownMenu>

const DEMO_ITEMS = [
{ label: 'Edit', onClick: () => {} },
{ label: 'Duplicate', onClick: () => {} },
{ label: 'Archive', onClick: () => {} },
{ label: 'Delete', onClick: () => {} },
]
const noop = () => undefined

export const Default: Story = {
render: () => <DropdownMenu items={DEMO_ITEMS} />,
const ActionsMenu = () => (
<DropdownMenu aria-label='Feature actions'>
<DropdownMenuItem onSelect={noop}>
<Icon name='copy' />
Copy feature name
</DropdownMenuItem>
<DropdownMenuItem onSelect={noop}>
<Icon name='list' />
Show audit logs
</DropdownMenuItem>
<DropdownMenuItem
disabled
description='History needs feature versioning'
onSelect={noop}
>
<Icon name='clock' />
Show history
</DropdownMenuItem>
<DropdownMenuItem destructive onSelect={noop}>
<Icon name='trash-2' />
Remove feature
</DropdownMenuItem>
</DropdownMenu>
)

const SECTIONS = ['Value', 'Segment overrides', 'History', 'Settings']

const SectionsMenu = () => {
const [current, setCurrent] = useState(2)
return (
<DropdownMenu
aria-label='Sections'
trigger={<Button theme='secondary'>{SECTIONS[current]}</Button>}
>
{SECTIONS.map((section, i) => (
<DropdownMenuItem
key={section}
selected={current === i}
onSelect={() => setCurrent(i)}
>
{section}
</DropdownMenuItem>
))}
</DropdownMenu>
)
}

export const Open: Story = {
const openMenu = async (canvasElement: HTMLElement, name: string) => {
const canvas = within(canvasElement)
await userEvent.click(canvas.getByRole('button', { name }))
await screen.findByRole('menu')
}

export const Actions: Story = {
parameters: { chromatic: { delay: 300 } },
play: ({ canvasElement }: { canvasElement: HTMLElement }) =>
openMenu(canvasElement, 'Feature actions'),
render: () => <ActionsMenu />,
}

export const CurrentItem: Story = {
parameters: { chromatic: { delay: 300 } },
play: ({ canvasElement }: { canvasElement: HTMLElement }) =>
openMenu(canvasElement, 'History'),
render: () => <SectionsMenu />,
}

// On phones the menu opens as a bottom sheet
export const MobileSheet: Story = {
globals: { viewport: { isRotated: false, value: 'mobile1' } },
parameters: {
chromatic: { delay: 300 },
docs: {
description: {
story:
'Menu in its open state. Storybook clicks the trigger in `play`; the menu portals into `document.body`, so it is queried via `screen` rather than the local canvas.',
},
},
},
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
const canvas = within(canvasElement)
await userEvent.click(canvas.getByRole('button'))
await screen.findByText('Edit')
docs: { story: { height: '420px', inline: false } },
},
render: () => <DropdownMenu items={DEMO_ITEMS} />,
play: ({ canvasElement }: { canvasElement: HTMLElement }) =>
openMenu(canvasElement, 'Feature actions'),
render: () => <ActionsMenu />,
}
3 changes: 3 additions & 0 deletions frontend/documentation/components/OverflowNav.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const NAV_ITEMS = (
export const ProjectNavbar: Story = {
render: () => (
<OverflowNav
label='More pages'
gap={3}
containerClassName='px-2 pb-1 bg-faint'
className='py-0 d-flex'
Expand All @@ -68,6 +69,7 @@ export const WithOverflow: Story = {
},
render: () => (
<OverflowNav
label='More pages'
force
gap={3}
containerClassName='px-2 pb-1 bg-faint'
Expand Down Expand Up @@ -97,6 +99,7 @@ export const OverflowOpen: Story = {
},
render: () => (
<OverflowNav
label='More pages'
force
gap={3}
containerClassName='px-2 pb-1 bg-faint'
Expand Down
28 changes: 18 additions & 10 deletions frontend/e2e/helpers/e2e-helpers.playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class E2EHelpers {
await element.waitFor({ state: 'visible', timeout: SHORT_TIMEOUT });
return;
} catch {
const overflowButton = this.page.locator(byId('overflow-nav-button')).first();
const overflowButton = this.page.getByRole('button', { name: /^More (project|organisation|environment) pages$/ }).filter({ visible: true }).first();
if (await overflowButton.isVisible()) {
await overflowButton.click();
}
Expand Down Expand Up @@ -612,7 +612,7 @@ export class E2EHelpers {
const dropdownSelector = byId(`select-segment-option-${selectionIndex}`);
const isDropdownVisible = await this.page.locator(dropdownSelector).isVisible().catch(() => false);
if (!isDropdownVisible) {
await this.click(byId('segment_overrides'));
await this.openFeatureTab('Segment Overrides');
}
await this.click(dropdownSelector);
await this.waitForElementVisible(this.segmentOverrideValueField(index));
Expand All @@ -638,7 +638,7 @@ export class E2EHelpers {
// Add a remote config override for a segment picked by name, so other
// segments in a shared project can't shift the selection
async addSegmentOverrideConfigForSegment(segmentName: string, value: string) {
await this.click(byId('segment_overrides'));
await this.openFeatureTab('Segment Overrides');
// E2E builds render the select's options as plain links
await this.page
.locator('[data-test^="select-segment-option-"]')
Expand All @@ -659,7 +659,7 @@ export class E2EHelpers {

// Set segment override index (for reordering)
async setSegmentOverrideIndex(index: number, newIndex: number) {
await this.click(byId('segment_overrides'));
await this.openFeatureTab('Segment Overrides');
await this.setText(byId(`sort-${index}`), `${newIndex}`);
}

Expand Down Expand Up @@ -809,15 +809,23 @@ export class E2EHelpers {
throw new Error(`Try-it failed after ${maxRetries} attempts: ${key}.${field} never became ${expected}`);
}

async openFeatureTab(name: string) {
const label = new RegExp(`^${name}`);
// A tab is a button; in the "More tabs" menu it is an option
const tab = this.page
.getByRole('button', { name: label })
.or(this.page.getByRole('menuitemradio', { name: label }))
.filter({ visible: true });
if (!(await tab.count())) {
await this.page.getByRole('button', { exact: true, name: 'More tabs' }).click();
}
await tab.first().click();
}

// Go to feature versions
async goToFeatureVersions(featureName: string) {
await this.gotoFeature(featureName);
if (await this.isElementExists('change-history')) {
await this.click(byId('change-history'));
} else {
await this.click(byId('tabs-overflow-button'));
await this.click(byId('change-history'));
}
await this.openFeatureTab('History');
}

// Compare version
Expand Down
5 changes: 3 additions & 2 deletions frontend/e2e/tests/environment-permission-test.pw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ test.describe('Environment Permission Tests', () => {
gotoTraits,
login,
logout,
openFeatureTab,
setUserPermission,
toggleFeature,
waitForElementClickable,
Expand Down Expand Up @@ -100,7 +101,7 @@ test.describe('Environment Permission Tests', () => {
await login(E2E_NON_ADMIN_USER_WITH_ENV_PERMISSIONS, PASSWORD)
await gotoProject(PROJECT_NAME)
await gotoFeature('my_feature')
await click(byId('segment_overrides'))
await openFeatureTab('Segment Overrides')
await waitForElementNotClickable('#update-feature-segments-btn')
await closeModal()
await logout()
Expand All @@ -112,7 +113,7 @@ test.describe('Environment Permission Tests', () => {
await login(E2E_NON_ADMIN_USER_WITH_ENV_PERMISSIONS, PASSWORD)
await gotoProject(PROJECT_NAME)
await gotoFeature('my_feature')
await click(byId('segment_overrides'))
await openFeatureTab('Segment Overrides')
await waitForElementClickable('#update-feature-segments-btn')
await closeModal()
await logout()
Expand Down
15 changes: 11 additions & 4 deletions frontend/e2e/tests/experimentation-test.pw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,14 @@ test.describe('Experimentation Tests', () => {
page,
}, testInfo) => {
await skipOnSaas()
const { click, closeModal, featureValueField, gotoFeature, gotoFeatures } =
await setup(page)
const {
click,
closeModal,
featureValueField,
gotoFeature,
gotoFeatures,
openFeatureTab,
} = await setup(page)

log('Create an experiment')
await createExperiment(page, FIRST_EXPERIMENT)
Expand All @@ -127,7 +133,7 @@ test.describe('Experimentation Tests', () => {
`This flag is part of the experiment ${FIRST_EXPERIMENT}`,
)
await expect(featureValueField()).not.toBeEditable()
await click(byId('segment_overrides'))
await openFeatureTab('Segment Overrides')
await expect(rolloutOverride(page)).toHaveCount(1)
await closeModal()
})
Expand All @@ -142,6 +148,7 @@ test.describe('Experimentation Tests', () => {
closeModal,
gotoFeature,
gotoFeatures,
openFeatureTab,
waitForToast,
} = await setup(page)

Expand Down Expand Up @@ -172,7 +179,7 @@ test.describe('Experimentation Tests', () => {
'100',
)
await expect(page.locator(byId('featureVariationWeighta'))).toHaveValue('0')
await click(byId('segment_overrides'))
await openFeatureTab('Segment Overrides')
await expectNoRolloutOverride(page)
await closeModal()
})
Expand Down
55 changes: 36 additions & 19 deletions frontend/web/components/IntegrationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
} from 'common/types/responses'
import map from 'lodash/map'
import Button from './base/forms/Button'
import DropdownMenu from './base/DropdownMenu'
import DropdownMenu, { DropdownMenuItem } from './base/DropdownMenu'
import { configuredActionsLabel } from './integrations/configuredActionsLabel'
import Icon from './icons/Icon'
import { IonIcon } from '@ionic/react'
import { close as closeIcon } from 'ionicons/icons'
Expand Down Expand Up @@ -270,7 +271,22 @@ const Integration: FC<IntegrationProps> = (props) => {
}
return button
}
return <DropdownMenu items={actions} />
return (
<DropdownMenu
aria-label={configuredActionsLabel(props.integration.title, 0, 1)}
>
{actions.map((action) => (
<DropdownMenuItem
key={action.label}
disabled={action.disabled}
description={action.disabled ? action.tooltip : undefined}
onSelect={action.onClick}
>
{action.label}
</DropdownMenuItem>
))}
</DropdownMenu>
)
}

return (
Expand Down Expand Up @@ -325,7 +341,7 @@ const Integration: FC<IntegrationProps> = (props) => {
)}

{activeIntegrations &&
activeIntegrations.map((integration) => (
activeIntegrations.map((integration, index) => (
<div
key={integration.id}
className='list-integrations clickable p-3 mt-3'
Expand All @@ -341,22 +357,23 @@ const Integration: FC<IntegrationProps> = (props) => {
integration={props.integration}
/>
</Flex>
<div onClick={(e) => e.stopPropagation()}>
<DropdownMenu
items={[
{
dataTest: 'edit-integration',
label: 'Edit',
onClick: () => edit(integration),
},
{
dataTest: 'delete-integration',
label: 'Delete',
onClick: () => remove(integration),
},
]}
/>
</div>
<DropdownMenu
aria-label={configuredActionsLabel(
props.integration.title,
index,
activeIntegrations.length,
)}
>
<DropdownMenuItem onSelect={() => edit(integration)}>
Edit
</DropdownMenuItem>
<DropdownMenuItem
destructive
onSelect={() => remove(integration)}
>
Delete
</DropdownMenuItem>
</DropdownMenu>
</Row>
</div>
))}
Expand Down
Loading
Loading