Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): build the step-by-step tour coachmark on Base UI Popover (#44934)

yyh4dfeac3be47d
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index 40b8563e372..60f501ea190 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -3936,16 +3936,6 @@
"count": 1
}
},
- "web/app/components/step-by-step-tour/coachmark.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 2
- }
- },
- "web/app/components/step-by-step-tour/mount.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 1
- }
- },
"web/app/components/tools/edit-custom-collection-modal/index.tsx": {
"eslint-react/set-state-in-effect": {
"count": 4
diff --git a/web/app/components/main-nav/__tests__/index.spec.tsx b/web/app/components/main-nav/__tests__/index.spec.tsx
index d813b811d9b..2290a015d67 100644
--- a/web/app/components/main-nav/__tests__/index.spec.tsx
+++ b/web/app/components/main-nav/__tests__/index.spec.tsx
@@ -19,10 +19,10 @@ import { LEARN_DIFY_HIDDEN_STORAGE_KEY } from '@/app/components/explore/learn-di
import { GotoAnything } from '@/app/components/goto-anything'
import { ACCOUNT_SETTING_TAB } from '@/app/components/header/account-setting/constants'
import {
+ stepByStepTourChecklistMinimizedAtom,
stepByStepTourSessionAtom,
stepByStepTourSkipRecoveryVisibleAtom,
} from '@/app/components/step-by-step-tour/state'
-import { STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY } from '@/app/components/step-by-step-tour/storage'
import { toast } from '@/app/notifications'
import { userProfileQueryOptions } from '@/features/account-profile/client'
import { usePathname, useRouter } from '@/next/navigation'
@@ -89,7 +89,6 @@ vi.mock('react-i18next', async () => {
'onboarding.stepByStepTour.duration': 'A quick tour — about 5 minutes',
'onboarding.stepByStepTour.skip': 'Skip tour',
'onboarding.stepByStepTour.minimize': 'Minimize tour',
- 'onboarding.stepByStepTour.restore': 'Open step-by-step tour',
'onboarding.stepByStepTour.learnMore': 'Learn more',
'onboarding.stepByStepTour.skipRecovery.label': 'Step-by-step Tour recovery tip',
'onboarding.stepByStepTour.skipRecovery.message':
@@ -784,14 +783,15 @@ describe('MainNav', () => {
it('closes the help menu and opens Step-by-step Tour when enabling it', async () => {
const user = userEvent.setup()
- localStorage.setItem(STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY, 'collapsed')
+ const store = createStore()
+ store.set(stepByStepTourChecklistMinimizedAtom, true)
mockStepByStepTour.setState({
first_workspace_id: null,
manually_enabled_workspace_ids: [],
manually_disabled_workspace_ids: [],
})
- renderMainNav({ enable_learn_app: true })
+ renderMainNav({ enable_learn_app: true }, { store })
await user.click(screen.getByRole('button', { name: 'navigation.mainNav.help.openMenu' }))
const stepByStepTourItem = await screen.findByRole('menuitemcheckbox', {
@@ -805,7 +805,7 @@ describe('MainNav', () => {
expect(mockStepByStepTour.patchState.mock.lastCall?.[0]).toEqual({
body: { action: 'enable_current_workspace' },
})
- expect(localStorage.getItem(STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY)).toBe('expanded')
+ expect(store.get(stepByStepTourChecklistMinimizedAtom)).toBe(false)
})
expect(mockTrackEvent).toHaveBeenCalledWith('step_tour', { action: 'tour_enabled' })
await waitFor(() => {
diff --git a/web/app/components/main-nav/components/help-menu.tsx b/web/app/components/main-nav/components/help-menu.tsx
index f4e9062325d..e8d0948e239 100644
--- a/web/app/components/main-nav/components/help-menu.tsx
+++ b/web/app/components/main-nav/components/help-menu.tsx
@@ -34,11 +34,11 @@ import { trackStepByStepTourEvent } from '@/app/components/step-by-step-tour/ana
import {
disableStepByStepTourForCurrentWorkspaceAtom,
enableStepByStepTourForCurrentWorkspaceAtom,
+ stepByStepTourChecklistMinimizedAtom,
stepByStepTourEnabledForCurrentWorkspaceAtom,
stepByStepTourSkipRecoveryVisibleAtom,
stepByStepTourStateUpdatingAtom,
} from '@/app/components/step-by-step-tour/state'
-import { useSetStepByStepTourShellMode } from '@/app/components/step-by-step-tour/storage'
import { MARKETPLACE_URL_PREFIX } from '@/config'
import { getLangGeniusVersionInfo } from '@/context/app-context-normalizers'
import { useDocLink } from '@/context/i18n'
@@ -119,7 +119,7 @@ const HelpMenu = ({ triggerIcon, triggerClassName, triggerRef, triggerSize }: He
const setSkipRecoveryVisible = useSetAtom(stepByStepTourSkipRecoveryVisibleAtom)
const enableStepByStepTour = useSetAtom(enableStepByStepTourForCurrentWorkspaceAtom)
const disableStepByStepTour = useSetAtom(disableStepByStepTourForCurrentWorkspaceAtom)
- const setStepByStepTourShellMode = useSetStepByStepTourShellMode()
+ const setStepByStepTourChecklistMinimized = useSetAtom(stepByStepTourChecklistMinimizedAtom)
const [aboutOpen, setAboutOpen] = useState(false)
const usesDefaultTrigger = !triggerIcon
const shouldShowLearnDifySwitch = systemFeatures.enable_learn_app
@@ -135,7 +135,7 @@ const HelpMenu = ({ triggerIcon, triggerClassName, triggerRef, triggerSize }: He
trackStepByStepTourEvent({ action: checked ? 'tour_enabled' : 'tour_disabled' })
if (checked) {
- setStepByStepTourShellMode('expanded')
+ setStepByStepTourChecklistMinimized(false)
enableStepByStepTour({
onSuccess: trackVisibilityToggled,
})
diff --git a/web/app/components/step-by-step-tour/__tests__/menu.spec.tsx b/web/app/components/step-by-step-tour/__tests__/menu.spec.tsx
index e429459bfdc..1b6c18452e7 100644
--- a/web/app/components/step-by-step-tour/__tests__/menu.spec.tsx
+++ b/web/app/components/step-by-step-tour/__tests__/menu.spec.tsx
@@ -17,9 +17,15 @@ function TestMenu({
return (
<>
- <button type="button" onClick={() => menu.onOpenChange(!menu.open)}>
+ <button
+ type="button"
+ onClick={() => menu.onOpenChange(!menu.open, { reason: 'trigger-press' })}
+ >
Toggle menu
</button>
+ <button type="button" onClick={() => menu.onOpenChange(false, { reason: 'outside-press' })}>
+ Press outside
+ </button>
<button type="button" onClick={menu.close}>
Close from action
</button>
@@ -55,6 +61,15 @@ describe('useStepByStepTourControlledMenu', () => {
expect(screen.getByText('Menu is closed and uncontrolled')).toBeInTheDocument()
})
+ it('keeps a tour-opened menu open on an outside press', async () => {
+ const user = userEvent.setup()
+ render(<TestMenu controlledOpen />)
+
+ await user.click(screen.getByRole('button', { name: 'Press outside' }))
+
+ expect(screen.getByText('Menu is open and controlled')).toBeInTheDocument()
+ })
+
it('can keep a tour-opened menu locked until the tour leaves the step', async () => {
const user = userEvent.setup()
render(<TestMenu controlledOpen allowTriggerCloseWhileControlled={false} />)
diff --git a/web/app/components/step-by-step-tour/__tests__/mount.spec.tsx b/web/app/components/step-by-step-tour/__tests__/mount.spec.tsx
index fa04d7d76f0..2325a25c27f 100644
--- a/web/app/components/step-by-step-tour/__tests__/mount.spec.tsx
+++ b/web/app/components/step-by-step-tour/__tests__/mount.spec.tsx
@@ -13,11 +13,11 @@ import { createDeferred } from '@/test/deferred'
import { createStepByStepTourService } from '@/test/fixtures/onboarding'
import { createNuqsTestWrapper } from '@/test/nuqs-testing'
import StepByStepTourMount from '../mount'
-import { stepByStepTourSessionAtom } from '../state'
-import { STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY } from '../storage'
+import { stepByStepTourChecklistMinimizedAtom, stepByStepTourSessionAtom } from '../state'
import { STEP_BY_STEP_TOUR_TARGETS } from '../target-registry'
let tourSession: StepByStepTourSessionState = {}
+let checklistMinimized = false
type StepByStepTourFixtureState = StepByStepTourSessionState & {
completedTaskIds: StepByStepTourTaskId[]
@@ -196,7 +196,6 @@ vi.mock('react-i18next', async () => {
'onboarding.stepByStepTour.completion.label': 'Step-by-step Tour completed',
'onboarding.stepByStepTour.completion.title': 'You’re all set',
'onboarding.stepByStepTour.minimize': 'Minimize tour',
- 'onboarding.stepByStepTour.restore': 'Open step-by-step tour',
'onboarding.stepByStepTour.learnMore': 'Learn more',
'onboarding.stepByStepTour.markTaskComplete': 'Mark {{title}} complete',
'onboarding.stepByStepTour.markTaskIncomplete': 'Mark {{title}} incomplete',
@@ -296,12 +295,7 @@ const setStepByStepTourTestState = (state: Partial<StepByStepTourFixtureState>)
activeGuideIndexes: state.activeGuideIndexes,
activeTaskId: state.activeTaskId,
}
- if (state.minimized !== undefined) {
- localStorage.setItem(
- STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY,
- state.minimized ? 'collapsed' : 'expanded',
- )
- }
+ checklistMinimized = state.minimized ?? false
}
const renderStepByStepTourMount = (searchParams = '') => {
@@ -329,6 +323,7 @@ const renderStepByStepTourMount = (searchParams = '') => {
const jotaiStore = createStore()
jotaiStore.set(queryClientAtom, queryClient)
jotaiStore.set(stepByStepTourSessionAtom, tourSession)
+ jotaiStore.set(stepByStepTourChecklistMinimizedAtom, checklistMinimized)
const { wrapper } = createNuqsTestWrapper({ searchParams })
return render(
@@ -579,7 +574,7 @@ describe('StepByStepTourMount', () => {
expect(screen.queryByText('Try a Learn Dify lesson')).not.toBeInTheDocument()
})
- it('persists the collapsed shell mode across remounts', async () => {
+ it('keeps the checklist minimized for the session only', async () => {
setStepByStepTourTestState({
manuallyEnabledWorkspaceIds: ['workspace-1'],
manuallyDisabledWorkspaceIds: [],
@@ -592,24 +587,18 @@ describe('StepByStepTourMount', () => {
await user.click(await screen.findByRole('button', { name: 'Minimize tour' }))
- await waitFor(() => {
- expect(localStorage.getItem(STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY)).toBe('collapsed')
- })
- expect(screen.getByRole('button', { name: 'Open step-by-step tour' })).toBeInTheDocument()
+ await waitFor(() =>
+ expect(screen.queryByRole('region', { name: 'Get to know Dify' })).not.toBeInTheDocument(),
+ )
+ expect(screen.getByRole('button', { name: /^Get to know Dify/ })).toHaveAttribute(
+ 'aria-expanded',
+ 'false',
+ )
+ // A new session, like a reload, starts with the checklist expanded again.
unmount()
renderStepByStepTourMount()
- expect(
- await screen.findByRole('button', { name: 'Open step-by-step tour' }),
- ).toBeInTheDocument()
- expect(screen.queryByRole('region', { name: 'Get to know Dify' })).not.toBeInTheDocument()
-
- await user.click(screen.getByRole('button', { name: 'Open step-by-step tour' }))
-
- await waitFor(() => {
- expect(localStorage.getItem(STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY)).toBe('expanded')
- })
expect(await screen.findByRole('region', { name: 'Get to know Dify' })).toBeInTheDocument()
})
@@ -635,12 +624,12 @@ describe('StepByStepTourMount', () => {
await waitFor(() => expect(minimizeButton).toHaveFocus())
await user.keyboard('{Enter}')
- const restoreButton = await screen.findByRole('button', { name: 'Open step-by-step tour' })
+ const restoreButton = await screen.findByRole('button', { name: /^Get to know Dify/ })
await waitFor(() => {
expect(restoreButton).toHaveFocus()
})
- expect(screen.getAllByRole('button', { name: 'Open step-by-step tour' })).toHaveLength(1)
+ expect(screen.getAllByRole('button', { name: /^Get to know Dify/ })).toHaveLength(1)
})
it('keeps the expanded checklist open after an outside pointer interaction', async () => {
@@ -658,14 +647,13 @@ describe('StepByStepTourMount', () => {
await user.click(document.body)
expect(dialog).toBeInTheDocument()
- expect(localStorage.getItem(STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY)).toBe('expanded')
})
- it('shows the completion prompt expanded even when the saved shell mode is collapsed', async () => {
- localStorage.setItem(STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY, 'collapsed')
+ it('shows the completion prompt expanded even when the checklist is minimized', async () => {
setStepByStepTourTestState({
manuallyEnabledWorkspaceIds: ['workspace-1'],
manuallyDisabledWorkspaceIds: [],
+ minimized: true,
completedTaskIds: ['home', 'studio', 'knowledge', 'integration'],
skipped: false,
})
@@ -676,7 +664,84 @@ describe('StepByStepTourMount', () => {
await screen.findByRole('region', { name: 'Step-by-step Tour completed' }),
).toBeInTheDocument()
expect(screen.getByRole('region', { name: 'Get to know Dify' })).toBeInTheDocument()
- expect(screen.queryByRole('button', { name: 'Open step-by-step tour' })).not.toBeInTheDocument()
+ expect(screen.getByRole('button', { name: /^Get to know Dify/ })).toHaveAttribute(
+ 'aria-expanded',
+ 'true',
+ )
+ })
+
+ it('keeps the checklist open when Escape is pressed elsewhere on the page', async () => {
+ setStepByStepTourTestState({
+ manuallyEnabledWorkspaceIds: ['workspace-1'],
+ manuallyDisabledWorkspaceIds: [],
+ minimized: false,
+ completedTaskIds: [],
+ skipped: false,
+ })
+ const search = document.createElement('input')
+ search.setAttribute('aria-label', 'Search apps')
+ document.body.appendChild(search)
+
+ try {
+ renderStepByStepTourMount()
+
+ await waitFor(() =>
+ expect(screen.getByRole('button', { name: 'Minimize tour' })).toHaveFocus(),
+ )
+ await user.click(search)
+ await user.keyboard('{Escape}')
+
+ expect(screen.getByRole('region', { name: 'Get to know Dify' })).toBeInTheDocument()
+ } finally {
+ search.remove()
+ }
+ })
+
+ it('minimizes the checklist when Tab moves past it', async () => {
+ setStepByStepTourTestState({
+ manuallyEnabledWorkspaceIds: ['workspace-1'],
+ manuallyDisabledWorkspaceIds: [],
+ minimized: false,
+ completedTaskIds: [],
+ skipped: false,
+ })
+
+ renderStepByStepTourMount()
+
+ const checklist = await screen.findByRole('dialog', { name: 'Get to know Dify' })
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Minimize tour' })).toHaveFocus())
+ const tabbables = checklist.querySelectorAll<HTMLElement>('button:not(:disabled), a[href]')
+ tabbables[tabbables.length - 1]!.focus()
+
+ await user.tab()
+
+ await waitFor(() =>
+ expect(screen.queryByRole('region', { name: 'Get to know Dify' })).not.toBeInTheDocument(),
+ )
+ expect(screen.getByRole('button', { name: /^Get to know Dify/ })).toHaveAttribute(
+ 'aria-expanded',
+ 'false',
+ )
+ })
+
+ it('minimizes the checklist with Escape and returns focus to its trigger', async () => {
+ setStepByStepTourTestState({
+ manuallyEnabledWorkspaceIds: ['workspace-1'],
+ manuallyDisabledWorkspaceIds: [],
+ minimized: false,
+ completedTaskIds: [],
+ skipped: false,
+ })
+
+ renderStepByStepTourMount()
+
+ expect(await screen.findByRole('region', { name: 'Get to know Dify' })).toBeInTheDocument()
+ await user.keyboard('{Escape}')
+
+ await waitFor(() =>
+ expect(screen.queryByRole('region', { name: 'Get to know Dify' })).not.toBeInTheDocument(),
+ )
+ expect(screen.getByRole('button', { name: /^Get to know Dify/ })).toHaveFocus()
})
it('hides expanded tour overlays while a blocking modal is open', async () => {
@@ -695,6 +760,7 @@ describe('StepByStepTourMount', () => {
expect(screen.queryByRole('region', { name: 'Get to know Dify' })).not.toBeInTheDocument()
})
expect(screen.queryByRole('dialog', { name: 'Get to know Dify' })).not.toBeInTheDocument()
+ expect(screen.queryByRole('button', { name: /^Get to know Dify/ })).not.toBeInTheDocument()
})
it('hides expanded tour overlays while settings is open', async () => {
@@ -767,7 +833,6 @@ describe('StepByStepTourMount', () => {
it('keeps the minimized tour entry available while a blocking modal is open', async () => {
mockHasBlockingModalOpen.value = true
- localStorage.setItem(STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY, 'collapsed')
setStepByStepTourTestState({
manuallyEnabledWorkspaceIds: ['workspace-1'],
manuallyDisabledWorkspaceIds: [],
@@ -778,9 +843,7 @@ describe('StepByStepTourMount', () => {
renderStepByStepTourMount()
- expect(
- await screen.findByRole('button', { name: 'Open step-by-step tour' }),
- ).toBeInTheDocument()
+ expect(await screen.findByRole('button', { name: /^Get to know Dify/ })).toBeInTheDocument()
expect(screen.queryByRole('region', { name: 'Get to know Dify' })).not.toBeInTheDocument()
})
@@ -845,7 +908,7 @@ describe('StepByStepTourMount', () => {
await user.click(screen.getByRole('button', { name: 'Take a look' }))
expect(mockRouterPush).toHaveBeenCalledWith('/integrations/model-provider')
- expect(await screen.findByRole('region', { name: 'Model Provider' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Model Provider' })).toBeInTheDocument()
expect(screen.getByText('1 of 5')).toBeInTheDocument()
expect(
screen.getByText(
@@ -916,7 +979,7 @@ describe('StepByStepTourMount', () => {
expect(mockRouterPush).toHaveBeenCalledWith('/')
expect(
- await screen.findByRole('region', { name: 'Pick a lesson to see how it works.' }),
+ await screen.findByRole('dialog', { name: 'Pick a lesson to see how it works.' }),
).toBeInTheDocument()
expect(screen.queryByText('Try a Learn Dify lesson')).not.toBeInTheDocument()
expect(screen.getByText('1 of 2')).toBeInTheDocument()
@@ -956,7 +1019,7 @@ describe('StepByStepTourMount', () => {
await user.click(await screen.findByRole('button', { name: 'Show me' }))
expect(mockRouterPush).toHaveBeenCalledWith('/')
- expect(await screen.findByRole('region', { name: 'Browse Learn Dify' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Browse Learn Dify' })).toBeInTheDocument()
expect(
screen.getByText(
'You can review lessons and see how Dify works here. Creating an app from a lesson requires a workspace where you have create permission, or help from an admin.',
@@ -1050,9 +1113,12 @@ describe('StepByStepTourMount', () => {
try {
renderStepByStepTourMount()
- expect(await screen.findByRole('region', { name: 'Model Provider' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Model Provider' })).toBeInTheDocument()
+ // A blocked step traps focus in the coachmark and hides the page behind it.
+ expect(screen.queryByRole('button', { name: /^Get to know Dify/ })).not.toBeInTheDocument()
const [minimizedTourButton] = screen.getAllByRole('button', {
- name: 'Open step-by-step tour',
+ name: /^Get to know Dify/,
+ hidden: true,
})
expect(minimizedTourButton).toBeInTheDocument()
expect(screen.getByText('1 of 6')).toBeInTheDocument()
@@ -1065,7 +1131,7 @@ describe('StepByStepTourMount', () => {
})
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'Tool Plugin' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Tool Plugin' })).toBeInTheDocument()
expect(screen.getByText('2 of 6')).toBeInTheDocument()
expect(mockRouterPush).toHaveBeenLastCalledWith('/integrations/tools/built-in')
expect(mockTrackEvent).toHaveBeenCalledWith('step_tour', {
@@ -1075,24 +1141,24 @@ describe('StepByStepTourMount', () => {
})
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'MCP' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'MCP' })).toBeInTheDocument()
expect(screen.getByText('3 of 6')).toBeInTheDocument()
expect(mockRouterPush).toHaveBeenLastCalledWith('/integrations/tools/mcp')
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'Data Source' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Data Source' })).toBeInTheDocument()
expect(screen.getByText('4 of 6')).toBeInTheDocument()
expect(screen.queryByRole('link', { name: 'Learn more' })).not.toBeInTheDocument()
expect(mockRouterPush).toHaveBeenLastCalledWith('/integrations/data-source')
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'Trigger' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Trigger' })).toBeInTheDocument()
expect(screen.getByText('5 of 6')).toBeInTheDocument()
expect(screen.queryByRole('link', { name: 'Learn more' })).not.toBeInTheDocument()
expect(mockRouterPush).toHaveBeenLastCalledWith('/integrations/trigger')
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'Update Settings' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Update Settings' })).toBeInTheDocument()
expect(screen.getByText('6 of 6')).toBeInTheDocument()
expect(mockRouterPush).toHaveBeenLastCalledWith('/integrations/tools/built-in')
@@ -1130,23 +1196,23 @@ describe('StepByStepTourMount', () => {
try {
renderStepByStepTourMount()
- expect(await screen.findByRole('region', { name: 'Model Provider' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Model Provider' })).toBeInTheDocument()
expect(screen.getByText('1 of 6')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'Tool Plugin' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Tool Plugin' })).toBeInTheDocument()
expect(screen.getByText('2 of 6')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'MCP' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'MCP' })).toBeInTheDocument()
expect(screen.getByText('3 of 6')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'Data Source' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Data Source' })).toBeInTheDocument()
expect(screen.getByText('4 of 6')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'Trigger' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Trigger' })).toBeInTheDocument()
expect(screen.getByText('5 of 6')).toBeInTheDocument()
const updateSettingsTarget = createTourTarget(
@@ -1157,7 +1223,7 @@ describe('StepByStepTourMount', () => {
mockPathname = '/integrations/tools/built-in'
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'Update Settings' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Update Settings' })).toBeInTheDocument()
expect(screen.getByText('6 of 6')).toBeInTheDocument()
} finally {
targets.forEach((target) => target.remove())
@@ -1195,23 +1261,23 @@ describe('StepByStepTourMount', () => {
try {
renderStepByStepTourMount()
- expect(await screen.findByRole('region', { name: 'Model Provider' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Model Provider' })).toBeInTheDocument()
expect(screen.getByText('1 of 5')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'Tool Plugin' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Tool Plugin' })).toBeInTheDocument()
expect(screen.getByText('2 of 5')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'MCP' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'MCP' })).toBeInTheDocument()
expect(screen.getByText('3 of 5')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'Data Source' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Data Source' })).toBeInTheDocument()
expect(screen.getByText('4 of 5')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Got it' }))
- expect(await screen.findByRole('region', { name: 'Trigger' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Trigger' })).toBeInTheDocument()
expect(screen.getByText('5 of 5')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Got it' }))
@@ -1220,7 +1286,7 @@ describe('StepByStepTourMount', () => {
expect(
await screen.findByRole('region', { name: 'Step-by-step Tour completed' }),
).toBeInTheDocument()
- expect(screen.queryByRole('region', { name: 'Update Settings' })).not.toBeInTheDocument()
+ expect(screen.queryByRole('dialog', { name: 'Update Settings' })).not.toBeInTheDocument()
} finally {
targets.forEach((target) => target.remove())
}
@@ -1247,7 +1313,7 @@ describe('StepByStepTourMount', () => {
try {
renderStepByStepTourMount()
- expect(await screen.findByRole('region', { name: 'Import a DSL file' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Import a DSL file' })).toBeInTheDocument()
expect(screen.getByText('3 of 3')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Got it' }))
@@ -1284,7 +1350,7 @@ describe('StepByStepTourMount', () => {
try {
renderStepByStepTourMount()
- expect(await screen.findByRole('region', { name: 'Create a new app' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Create a new app' })).toBeInTheDocument()
expect(screen.getByText('1 of 1')).toBeInTheDocument()
await user.click(screen.getByRole('button', { name: 'Got it' }))
@@ -1311,7 +1377,7 @@ describe('StepByStepTourMount', () => {
try {
renderStepByStepTourMount()
- expect(await screen.findByRole('region', { name: 'Tool Plugin' })).toBeInTheDocument()
+ expect(await screen.findByRole('dialog', { name: 'Tool Plugin' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Got it' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'Skip tour' })).toBeInTheDocument()
expect(screen.queryByRole('link', { name: 'Learn more' })).not.toBeInTheDocument()
@@ -1326,7 +1392,6 @@ describe('StepByStepTourMount', () => {
expect(
mockStepByStepTour.patchState.mock.calls.map(([variables]) => variables.body),
).not.toContainEqual(expect.objectContaining({ action: 'complete_task' }))
- expect(localStorage.getItem(STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY)).toBe('expanded')
expect(screen.getByRole('region', { name: 'Get to know Dify' })).toBeInTheDocument()
expect(
screen.queryByRole('dialog', { name: 'Step-by-step Tour recovery tip' }),
@@ -1341,6 +1406,121 @@ describe('StepByStepTourMount', () => {
}
})
+ it('focuses the primary action and skips the active walkthrough with Escape', async () => {
+ mockPathname = '/integrations/model-provider'
+ setStepByStepTourTestState({
+ activeTaskId: 'integration',
+ activeGuideIndex: 1,
+ manuallyEnabledWorkspaceIds: ['workspace-1'],
+ manuallyDisabledWorkspaceIds: [],
+ minimized: true,
+ completedTaskIds: ['home', 'studio', 'knowledge'],
+ skipped: false,
+ })
+ const target = createTourTarget(STEP_BY_STEP_TOUR_TARGETS.integrationToolPluginNav)
+
+ try {
+ renderStepByStepTourMount()
+
+ expect(await screen.findByRole('dialog', { name: 'Tool Plugin' })).toBeInTheDocument()
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Got it' })).toHaveFocus())
+
+ await user.keyboard('{Escape}')
+
+ expect(screen.queryByRole('dialog', { name: 'Tool Plugin' })).not.toBeInTheDocument()
+ expect(screen.getByRole('region', { name: 'Get to know Dify' })).toBeInTheDocument()
+ expect(
+ mockTrackEvent.mock.calls.filter(([, event]) => event.action === 'guide_skipped'),
+ ).toEqual([
+ [
+ 'step_tour',
+ { action: 'guide_skipped', guide_id: 'integration.tool_plugin', task_id: 'integration' },
+ ],
+ ])
+ expect(
+ mockStepByStepTour.patchState.mock.calls.map(([variables]) => variables.body),
+ ).not.toContainEqual(expect.objectContaining({ action: 'complete_task' }))
+ } finally {
+ target.remove()
+ }
+ })
+
+ it('moves Tab from the coachmark into the target of a step that waits for the user', async () => {
+ setStepByStepTourTestState({
+ activeTaskId: 'home',
+ activeGuideIndex: 0,
+ manuallyEnabledWorkspaceIds: ['workspace-1'],
+ manuallyDisabledWorkspaceIds: [],
+ minimized: true,
+ completedTaskIds: [],
+ skipped: false,
+ })
+ const target = createTourTarget(STEP_BY_STEP_TOUR_TARGETS.home, 120, {
+ height: 180,
+ left: 40,
+ width: 360,
+ })
+ const lesson = document.createElement('button')
+ lesson.textContent = 'Lesson'
+ target.appendChild(lesson)
+
+ try {
+ renderStepByStepTourMount()
+
+ const coachmark = await screen.findByRole('dialog', {
+ name: 'Pick a lesson to see how it works.',
+ })
+ await waitFor(() => expect(coachmark).toHaveFocus())
+
+ await user.tab()
+ expect(screen.getByRole('button', { name: 'Skip tour' })).toHaveFocus()
+
+ await user.tab()
+ expect(lesson).toHaveFocus()
+ expect(coachmark).toBeInTheDocument()
+ expect(mockTrackEvent).not.toHaveBeenCalledWith(
+ 'step_tour',
+ expect.objectContaining({ action: 'guide_skipped' }),
+ )
+ } finally {
+ target.remove()
+ }
+ })
+
+ it('closes the coachmark while its target is missing and opens it once the target renders', async () => {
+ mockPathname = '/integrations/model-provider'
+ setStepByStepTourTestState({
+ activeTaskId: 'integration',
+ activeGuideIndex: 1,
+ manuallyEnabledWorkspaceIds: ['workspace-1'],
+ manuallyDisabledWorkspaceIds: [],
+ minimized: true,
+ completedTaskIds: ['home', 'studio', 'knowledge'],
+ skipped: false,
+ })
+ let target: HTMLElement | undefined
+
+ try {
+ renderStepByStepTourMount()
+
+ expect(await screen.findByRole('button', { name: /^Get to know Dify/ })).toBeInTheDocument()
+ expect(screen.queryByRole('dialog', { name: 'Tool Plugin' })).not.toBeInTheDocument()
+
+ target = createTourTarget(STEP_BY_STEP_TOUR_TARGETS.integrationToolPluginNav)
+
+ expect(await screen.findByRole('dialog', { name: 'Tool Plugin' })).toBeInTheDocument()
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Got it' })).toHaveFocus())
+
+ target.remove()
+
+ await waitFor(() =>
+ expect(screen.queryByRole('dialog', { name: 'Tool Plugin' })).not.toBeInTheDocument(),
+ )
+ } finally {
+ target?.remove()
+ }
+ })
+
it('keeps the minimized tour control visible when an active guide target is unavailable', async () => {
mockPathname = '/app/test-app/overview'
setStepByStepTourTestState({
@@ -1354,8 +1534,6 @@ describe('StepByStepTourMount', () => {
renderStepByStepTourMount()
- expect(
- await screen.findAllByRole('button', { name: 'Open step-by-step tour' }),
- ).not.toHaveLength(0)
+ expect(await screen.findAllByRole('button', { name: /^Get to know Dify/ })).not.toHaveLength(0)
})
})
diff --git a/web/app/components/step-by-step-tour/coachmark.tsx b/web/app/components/step-by-step-tour/coachmark.tsx
index 964758ccf93..c310360922e 100644
--- a/web/app/components/step-by-step-tour/coachmark.tsx
+++ b/web/app/components/step-by-step-tour/coachmark.tsx
@@ -1,74 +1,83 @@
'use client'
-import type { CSSProperties } from 'react'
+import type { PopoverChangeEventDetails, PopoverPositionerProps } from '@langgenius/dify-ui/popover'
+import type { KeyboardEvent } from 'react'
import type { StepByStepTourGuide, StepByStepTourGuideInteractionPolicy } from './target-registry'
-import type {
- StepByStepTourCoachmarkPlacement,
- StepByStepTourCoachmarkSize,
-} from './use-coachmark-position'
-import { Button } from '@langgenius/dify-ui/button'
+import type { StepByStepTourTargetRect } from './use-target-rect'
+import { Button, buttonVariants } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
-import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react'
-import { createPortal } from 'react-dom'
+import {
+ Popover,
+ PopoverArrow,
+ PopoverBackdrop,
+ PopoverClose,
+ PopoverDescription,
+ PopoverPopup,
+ PopoverPortal,
+ PopoverPositioner,
+ PopoverTitle,
+} from '@langgenius/dify-ui/popover'
+import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
import { getStepByStepTourGuideKind, getStepByStepTourTargetSelector } from './target-registry'
-import { useStepByStepTourCoachmarkPosition } from './use-coachmark-position'
import { useStepByStepTourTargetRect } from './use-target-rect'
const HIGHLIGHT_PADDING = 4
-const DEFAULT_COACHMARK_SIZE: StepByStepTourCoachmarkSize = {
- height: 158,
- width: 352,
-}
-const STEP_BY_STEP_TOUR_PORTAL_ROOT_ATTRIBUTE = 'data-step-by-step-tour-portal-root'
-const VERTICAL_ARROW_LENGTH = 28
-const VERTICAL_ARROW_DOT_SIZE = 12
-const VERTICAL_ARROW_DOT_OVERHANG = 3
-const VERTICAL_ARROW_OPTICAL_OFFSET = 1
-const VERTICAL_ARROW_EDGE_OFFSET =
- VERTICAL_ARROW_LENGTH -
- VERTICAL_ARROW_DOT_SIZE / 2 -
- HIGHLIGHT_PADDING +
- VERTICAL_ARROW_OPTICAL_OFFSET
+// The vertical arrow's dot sits this far from the target's left edge, as in the Figma frame.
+const VERTICAL_ARROW_DOT_LEFT = 28
+const STEP_GLIDE_DURATION = 400
+const STEP_GLIDE_CLASS_NAME =
+ 'data-gliding:duration-300 data-gliding:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none'
+const TARGET_TABBABLE_SELECTOR =
+ 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])'
-const VERTICAL_ARROW_DOT_STYLE: CSSProperties = {
- top: -VERTICAL_ARROW_DOT_OVERHANG,
-}
-const SKIP_BUTTON_CLASS_NAME =
- 'shrink-0 cursor-pointer rounded-md border-none bg-transparent p-0 text-left system-sm-regular text-text-tertiary outline-hidden hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid'
+type StepByStepTourCoachmarkPlacement = 'bottom' | 'inline-end' | 'top'
-const getStepByStepTourVerticalArrowStyle = (
+// Base UI centers the arrow on the anchor: narrow the anchor to the spot the arrow points at, and let
+// `alignOffset` move the popup back to the highlight's edge.
+const getStepByStepTourCoachmarkAnchoring = (
placement: StepByStepTourCoachmarkPlacement,
- arrowStyle: CSSProperties,
-): CSSProperties => ({
- ...arrowStyle,
- ...(placement === 'top'
- ? { bottom: -VERTICAL_ARROW_EDGE_OFFSET }
- : { top: -VERTICAL_ARROW_EDGE_OFFSET }),
-})
+ highlightRect: StepByStepTourTargetRect,
+ anchorRect: StepByStepTourTargetRect,
+): Pick<PopoverPositionerProps, 'alignOffset' | 'anchor'> => {
+ if (placement === 'inline-end') {
+ const rect = new DOMRect(
+ highlightRect.left,
+ anchorRect.top,
+ highlightRect.width,
+ anchorRect.height,
+ )
+ return { anchor: { getBoundingClientRect: () => rect }, alignOffset: 0 }
+ }
-const useStepByStepTourPortalRoot = (enabled: boolean) => {
- const portalRoot = useMemo(() => {
- if (!enabled || typeof document === 'undefined') return null
+ const arrowDotLeft = anchorRect.left + VERTICAL_ARROW_DOT_LEFT
+ const rect = new DOMRect(arrowDotLeft, highlightRect.top, 2, highlightRect.height)
+ return {
+ anchor: { getBoundingClientRect: () => rect },
+ alignOffset: highlightRect.left - arrowDotLeft,
+ }
+}
- const portalElement = document.createElement('div')
- portalElement.setAttribute(STEP_BY_STEP_TOUR_PORTAL_ROOT_ATTRIBUTE, '')
- return portalElement
- }, [enabled])
+const getTargetOnlyClipPath = ({ height, left, top, width }: StepByStepTourTargetRect) => {
+ const right = left + width
+ const bottom = top + height
+ return `polygon(evenodd,0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${left}px ${top}px,${left}px ${bottom}px,${right}px ${bottom}px,${right}px ${top}px,${left}px ${top}px)`
+}
- useLayoutEffect(() => {
- if (!portalRoot) return
+const useStepGliding = (stepKey: string | undefined) => {
+ const [glide, setGlide] = useState({ gliding: false, stepKey })
+ if (glide.stepKey !== stepKey) setGlide({ gliding: Boolean(glide.stepKey && stepKey), stepKey })
- document.body.appendChild(portalRoot)
- return () => {
- portalRoot.remove()
- }
- }, [portalRoot])
+ useEffect(() => {
+ if (!glide.gliding) return
- useLayoutEffect(() => {
- if (portalRoot && portalRoot.nextSibling) document.body.appendChild(portalRoot)
- })
+ const timeout = window.setTimeout(
+ () => setGlide((current) => ({ ...current, gliding: false })),
+ STEP_GLIDE_DURATION,
+ )
+ return () => window.clearTimeout(timeout)
+ }, [glide])
- return portalRoot
+ return glide.gliding
}
type StepByStepTourCoachmarkGuide = Omit<
@@ -84,7 +93,7 @@ type StepByStepTourCoachmarkGuide = Omit<
type StepByStepTourCoachmarkProps = {
guide: StepByStepTourCoachmarkGuide
- targetElement: HTMLElement
+ targetElement: HTMLElement | null
placement?: StepByStepTourCoachmarkPlacement
stepLabel: string
skipLabel: string
@@ -93,6 +102,15 @@ type StepByStepTourCoachmarkProps = {
onComplete: () => void
}
+type StepByStepTourCoachmarkOverlay = Omit<
+ StepByStepTourCoachmarkProps,
+ 'onComplete' | 'onSkip' | 'targetElement'
+> & {
+ anchorRect: StepByStepTourTargetRect
+ highlightRect: StepByStepTourTargetRect
+ placement: StepByStepTourCoachmarkPlacement
+}
+
export function StepByStepTourCoachmark({
guide,
targetElement,
@@ -103,311 +121,259 @@ export function StepByStepTourCoachmark({
onSkip,
onComplete,
}: StepByStepTourCoachmarkProps) {
- const {
- anchorRect,
- highlightPartsReady,
- highlightRect,
- rectSettled,
- targetElement: measuredTargetElement,
- } = useStepByStepTourTargetRect(targetElement, guide.highlightPartSelectors)
- const coachmarkRef = useRef<HTMLDivElement>(null)
- const coachmarkSizeFrameRef = useRef<number | undefined>(undefined)
- const shouldUseLatePortalRoot = guide.portalOrder === 'afterOverlays'
- const portalRoot = useStepByStepTourPortalRoot(shouldUseLatePortalRoot)
- const [coachmarkSize, setCoachmarkSize] =
- useState<StepByStepTourCoachmarkSize>(DEFAULT_COACHMARK_SIZE)
- const coachmarkPosition = useStepByStepTourCoachmarkPosition(
- highlightRect,
- placement,
- anchorRect,
- coachmarkSize,
- )
- const stableOverlayRef = useRef<
- | {
- coachmarkPosition: ReturnType<typeof useStepByStepTourCoachmarkPosition>
- guide: StepByStepTourCoachmarkGuide
- highlightRect: typeof highlightRect
- onComplete: () => void
- onSkip: () => void
- placement: StepByStepTourCoachmarkPlacement
- skipLabel: string
- interactionPolicy: StepByStepTourGuideInteractionPolicy
- stepLabel: string
- }
- | undefined
- >(undefined)
+ const targetRects = useStepByStepTourTargetRect(targetElement, guide.highlightPartSelectors)
+ const portalRef = useRef<HTMLDivElement>(null)
+ const popupRef = useRef<HTMLDivElement>(null)
+ const primaryActionRef = useRef<HTMLButtonElement>(null)
+ const lastOverlayRef = useRef<StepByStepTourCoachmarkOverlay | undefined>(undefined)
- const measuredRectMatchesGuide =
- measuredTargetElement === targetElement &&
+ const currentOverlay: StepByStepTourCoachmarkOverlay | undefined =
+ targetElement &&
+ targetRects?.targetElement === targetElement &&
+ targetRects.highlightPartsReady &&
+ targetRects.rectSettled &&
targetElement.matches(getStepByStepTourTargetSelector(guide.target))
- const currentOverlayReady = highlightPartsReady && rectSettled && measuredRectMatchesGuide
- const currentOverlay = currentOverlayReady
- ? {
- coachmarkPosition,
- guide,
- highlightRect,
- onComplete,
- onSkip,
- placement: coachmarkPosition.placement,
- skipLabel,
- interactionPolicy,
- stepLabel,
- }
- : undefined
+ ? {
+ anchorRect: targetRects.anchorRect,
+ guide,
+ highlightRect: targetRects.highlightRect,
+ interactionPolicy,
+ placement,
+ skipLabel,
+ stepLabel,
+ }
+ : undefined
+
+ const [awaitingTarget, setAwaitingTarget] = useState(!targetElement)
+ if (!targetElement && !awaitingTarget) setAwaitingTarget(true)
+ if (currentOverlay && awaitingTarget) setAwaitingTarget(false)
useLayoutEffect(() => {
- if (!currentOverlayReady) return
+ if (currentOverlay) lastOverlayRef.current = currentOverlay
+ })
- stableOverlayRef.current = {
- coachmarkPosition,
- guide,
- highlightRect,
- onComplete,
- onSkip,
- placement: coachmarkPosition.placement,
- skipLabel,
- interactionPolicy,
- stepLabel,
- }
- }, [
- coachmarkPosition,
- currentOverlayReady,
- guide,
- highlightRect,
- interactionPolicy,
- onComplete,
- onSkip,
- skipLabel,
- stepLabel,
- ])
+ const overlay = currentOverlay ?? lastOverlayRef.current
+ const open = Boolean(targetElement && !awaitingTarget && overlay)
+ const gliding = useStepGliding(open ? overlay?.guide.id : undefined)
+ const isActionGuide = overlay ? getStepByStepTourGuideKind(overlay.guide) === 'action' : false
+ const overlayPlacement = overlay?.placement
+ const overlayHighlightRect = overlay?.highlightRect
+ const overlayAnchorRect = overlay?.anchorRect
+ const anchoring = useMemo(
+ () =>
+ overlayPlacement && overlayHighlightRect && overlayAnchorRect
+ ? getStepByStepTourCoachmarkAnchoring(
+ overlayPlacement,
+ overlayHighlightRect,
+ overlayAnchorRect,
+ )
+ : undefined,
+ [overlayPlacement, overlayHighlightRect, overlayAnchorRect],
+ )
- const stableOverlay = currentOverlay ?? stableOverlayRef.current
- const isActionGuide = stableOverlay
- ? getStepByStepTourGuideKind(stableOverlay.guide) === 'action'
- : false
- const coachmarkMeasurementKey = stableOverlay
- ? [
- stableOverlay.guide.target,
- stableOverlay.guide.title,
- stableOverlay.guide.description,
- stableOverlay.guide.learnMoreHref,
- stableOverlay.guide.learnMoreLabel,
- stableOverlay.guide.primaryActionLabel,
- stableOverlay.placement,
- stableOverlay.stepLabel,
- stableOverlay.skipLabel,
- isActionGuide,
- ].join('|')
- : undefined
- const highlightStyle: CSSProperties | undefined = stableOverlay
- ? {
- height: stableOverlay.highlightRect.height + HIGHLIGHT_PADDING * 2,
- left: stableOverlay.highlightRect.left - HIGHLIGHT_PADDING,
- top: stableOverlay.highlightRect.top - HIGHLIGHT_PADDING,
- width: stableOverlay.highlightRect.width + HIGHLIGHT_PADDING * 2,
- }
- : undefined
+ // Overlays stack in DOM order: remount after an overlay that holds the target and opened later.
+ const [portalKey, setPortalKey] = useState(0)
+ useLayoutEffect(() => {
+ const portal = portalRef.current
+ if (
+ open &&
+ portal &&
+ targetElement &&
+ portal.compareDocumentPosition(targetElement) & Node.DOCUMENT_POSITION_FOLLOWING
+ )
+ setPortalKey((key) => key + 1)
+ }, [open, targetElement])
- const syncCoachmarkSize = useCallback((element: HTMLElement) => {
- const rect = element.getBoundingClientRect()
- const nextSize = {
- height: Math.ceil(rect.height),
- width: Math.ceil(rect.width),
- }
- if (nextSize.height <= 0 || nextSize.width <= 0) return
+ const readyStepKey = currentOverlay?.guide.id
+ useEffect(() => {
+ const popup = popupRef.current
+ if (!readyStepKey || !popup) return
- setCoachmarkSize((currentSize) =>
- currentSize.height === nextSize.height && currentSize.width === nextSize.width
- ? currentSize
- : nextSize,
+ const activeElement = document.activeElement
+ if (
+ activeElement &&
+ activeElement !== document.body &&
+ !activeElement.closest('[aria-hidden="true"]')
)
- }, [])
+ return
- useLayoutEffect(() => {
- const element = coachmarkRef.current
- if (!element) return
+ ;(primaryActionRef.current ?? popup).focus()
+ }, [readyStepKey])
- coachmarkSizeFrameRef.current = window.requestAnimationFrame(() => {
- coachmarkSizeFrameRef.current = undefined
- syncCoachmarkSize(element)
- })
+ const spotlightRect = overlay && {
+ height: overlay.highlightRect.height + HIGHLIGHT_PADDING * 2,
+ left: overlay.highlightRect.left - HIGHLIGHT_PADDING,
+ top: overlay.highlightRect.top - HIGHLIGHT_PADDING,
+ width: overlay.highlightRect.width + HIGHLIGHT_PADDING * 2,
+ }
- return () => {
- if (coachmarkSizeFrameRef.current !== undefined) {
- window.cancelAnimationFrame(coachmarkSizeFrameRef.current)
- coachmarkSizeFrameRef.current = undefined
- }
- }
- }, [coachmarkMeasurementKey, syncCoachmarkSize])
+ const handleOpenChange = (nextOpen: boolean, eventDetails: PopoverChangeEventDetails) => {
+ if (
+ !nextOpen &&
+ (eventDetails.reason === 'escape-key' || eventDetails.reason === 'close-press')
+ )
+ onSkip()
+ }
- if (typeof document === 'undefined') return null
- if (shouldUseLatePortalRoot && !portalRoot) return null
+ // Without a trigger, Tab out of the popup would land at the end of the document.
+ const handleSkipKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {
+ if (event.key !== 'Tab' || event.shiftKey || !targetElement) return
- const targetBlockerStyles: CSSProperties[] =
- stableOverlay && highlightStyle
- ? [
- {
- height: highlightStyle.top,
- left: 0,
- right: 0,
- top: 0,
- },
- {
- bottom: 0,
- left: 0,
- top: Number(highlightStyle.top) + Number(highlightStyle.height),
- right: 0,
- },
- {
- height: highlightStyle.height,
- left: 0,
- top: highlightStyle.top,
- width: highlightStyle.left,
- },
- {
- height: highlightStyle.height,
- left: Number(highlightStyle.left) + Number(highlightStyle.width),
- right: 0,
- top: highlightStyle.top,
- },
- ]
- : []
+ const targetTabbable = targetElement.matches(TARGET_TABBABLE_SELECTOR)
+ ? targetElement
+ : targetElement.querySelector<HTMLElement>(TARGET_TABBABLE_SELECTOR)
+ if (!targetTabbable) return
- return createPortal(
- <>
- {stableOverlay?.interactionPolicy === 'target-only' ? (
- targetBlockerStyles.map((style, index) => (
- <div
- // oxlint-disable-next-line react/no-array-index-key -- The four blocker slices are static and positional.
- key={index}
- aria-hidden="true"
- data-step-by-step-tour-backdrop=""
- data-step-by-step-tour-blocker=""
- className="fixed cursor-default bg-transparent"
- style={style}
- />
- ))
- ) : (
- <div
- aria-hidden="true"
- data-step-by-step-tour-backdrop=""
- className="fixed inset-0 cursor-default bg-transparent"
- />
- )}
- {stableOverlay && highlightStyle && (
- <>
- <div
- aria-hidden="true"
+ event.preventDefault()
+ targetTabbable.focus()
+ }
+
+ return (
+ <Popover
+ open={open}
+ onOpenChange={handleOpenChange}
+ modal={overlay?.interactionPolicy === 'blocked' ? 'trap-focus' : false}
+ >
+ {overlay && anchoring && (
+ <PopoverPortal key={portalKey} ref={portalRef}>
+ {open && (
+ <div
+ aria-hidden="true"
+ data-step-by-step-tour-blocker=""
+ className="fixed inset-0 cursor-default"
+ style={{
+ clipPath:
+ overlay.interactionPolicy === 'target-only' && spotlightRect
+ ? getTargetOnlyClipPath(spotlightRect)
+ : undefined,
+ }}
+ />
+ )}
+ <PopoverBackdrop
data-step-by-step-tour-highlight=""
- className="pointer-events-none fixed rounded-xl shadow-[0_0_0_9999px_var(--color-background-overlay)]"
- style={highlightStyle}
+ data-gliding={gliding ? '' : undefined}
+ className={cn(
+ 'pointer-events-none inset-auto rounded-xl shadow-[0_0_0_9999px_var(--color-background-overlay)] transition-opacity data-ending-style:opacity-0 data-gliding:transition-[top,left,width,height,opacity] data-starting-style:opacity-0',
+ STEP_GLIDE_CLASS_NAME,
+ )}
+ style={spotlightRect}
/>
- <div
- ref={coachmarkRef}
- className="fixed w-88 max-w-[calc(100vw-16px)]"
+ <PopoverPositioner
+ anchor={anchoring.anchor}
+ side={overlay.placement}
+ align={overlay.placement === 'inline-end' ? 'center' : 'start'}
+ alignOffset={anchoring.alignOffset}
+ sideOffset={20}
+ arrowPadding={12}
+ collisionPadding={8}
+ collisionAvoidance={{ side: 'flip', align: 'shift', fallbackAxisSide: 'none' }}
+ positionMethod="fixed"
+ data-gliding={gliding ? '' : undefined}
data-step-by-step-tour-coachmark=""
- style={stableOverlay.coachmarkPosition.bubbleStyle}
+ className={cn('data-gliding:transition-[top,left,transform]', STEP_GLIDE_CLASS_NAME)}
>
- {stableOverlay.placement === 'right' ? (
- <span
- aria-hidden="true"
- className="pointer-events-none absolute -left-1.5 size-3 rotate-45 border-b-[0.5px] border-l-[0.5px] border-state-accent-hover-alt bg-state-accent-hover"
- style={stableOverlay.coachmarkPosition.arrowStyle}
- />
- ) : (
- <div
- className={cn(
- 'pointer-events-none absolute h-7 w-0.5',
- stableOverlay.placement === 'top' && 'rotate-180',
- )}
- style={getStepByStepTourVerticalArrowStyle(
- stableOverlay.placement,
- stableOverlay.coachmarkPosition.arrowStyle,
- )}
- aria-hidden="true"
- >
- <span className="absolute top-0 left-1/2 h-7 w-0.5 -translate-x-1/2 bg-state-accent-hover-alt shadow-[0_20px_24px_-4px_var(--color-shadow-shadow-5),0_8px_8px_-4px_var(--color-shadow-shadow-1)]" />
- <span
- style={VERTICAL_ARROW_DOT_STYLE}
- className="absolute left-1/2 size-3 -translate-x-1/2 rounded-full border-2 border-state-accent-hover bg-state-accent-solid shadow-xs"
- />
- </div>
- )}
- <section
- aria-label={
- isActionGuide ? stableOverlay.guide.description : stableOverlay.guide.title
- }
+ <PopoverPopup
+ ref={popupRef}
+ initialFocus={() => primaryActionRef.current ?? popupRef.current}
+ finalFocus={false}
className={cn(
- 'relative flex w-full flex-col rounded-2xl border-[0.5px] border-state-accent-hover-alt bg-state-accent-hover p-4 shadow-[0_20px_24px_-4px_var(--color-shadow-shadow-5),0_8px_8px_-4px_var(--color-shadow-shadow-1)] backdrop-blur-[5px]',
+ 'relative flex w-88 max-w-[calc(100vw-16px)] flex-col rounded-2xl border-[0.5px] border-state-accent-hover-alt bg-state-accent-hover p-4 shadow-[0_20px_24px_-4px_var(--color-shadow-shadow-5),0_8px_8px_-4px_var(--color-shadow-shadow-1)] backdrop-blur-[5px]',
isActionGuide ? 'min-h-29.5' : 'min-h-39.5',
)}
>
- {isActionGuide ? (
- <>
- <div className="pb-0.5 system-2xs-semibold-uppercase text-text-tertiary">
- {stableOverlay.stepLabel}
+ <PopoverArrow
+ className={(state) =>
+ state.side === 'inline-end' || state.side === 'inline-start'
+ ? cn(
+ 'pointer-events-none size-3 rotate-45 border-state-accent-hover-alt bg-state-accent-hover',
+ state.side === 'inline-end'
+ ? '-inset-s-1.5 border-s-[0.5px] border-b-[0.5px]'
+ : '-inset-e-1.5 border-e-[0.5px] border-t-[0.5px]',
+ )
+ : cn(
+ 'pointer-events-none h-7 w-0.5',
+ state.side === 'top' ? '-bottom-4.75 rotate-180' : '-top-4.75',
+ )
+ }
+ render={(props, state) => (
+ <div {...props}>
+ {(state.side === 'top' || state.side === 'bottom') && (
+ <>
+ <span className="absolute top-0 left-1/2 h-7 w-0.5 -translate-x-1/2 bg-state-accent-hover-alt shadow-[0_20px_24px_-4px_var(--color-shadow-shadow-5),0_8px_8px_-4px_var(--color-shadow-shadow-1)]" />
+ <span className="absolute -top-0.75 left-1/2 size-3 -translate-x-1/2 rounded-full border-2 border-state-accent-hover bg-state-accent-solid shadow-xs" />
+ </>
+ )}
</div>
- <p className="mt-1 system-md-medium text-text-primary">
- {stableOverlay.guide.description}
- </p>
- <div className="mt-auto flex h-12 items-end justify-start pt-4">
- <button
- type="button"
- className={SKIP_BUTTON_CLASS_NAME}
- onClick={stableOverlay.onSkip}
- >
- {stableOverlay.skipLabel}
- </button>
- </div>
- </>
- ) : (
- <>
- <div className="pb-0.5 system-2xs-semibold-uppercase text-text-tertiary">
- {stableOverlay.stepLabel}
- </div>
- <h2 className="mt-1 system-md-medium text-text-primary">
- {stableOverlay.guide.title}
- </h2>
- <p className="mt-1 system-xs-regular text-text-secondary">
- {stableOverlay.guide.description}
- </p>
- <div className="mt-auto flex h-12 items-center justify-between gap-3 pt-4">
- <button
- type="button"
- className={SKIP_BUTTON_CLASS_NAME}
- onClick={stableOverlay.onSkip}
- >
- {stableOverlay.skipLabel}
- </button>
- <div className="flex shrink-0 items-center gap-1">
- {stableOverlay.guide.learnMoreHref && (
- <a
- href={stableOverlay.guide.learnMoreHref}
- target="_blank"
- rel="noopener noreferrer"
- className="inline-flex h-8 shrink-0 items-center justify-center gap-1 rounded-lg px-3 system-sm-medium text-text-tertiary outline-hidden hover:bg-components-button-ghost-bg-hover focus-visible:ring-2 focus-visible:ring-state-accent-solid"
- >
- {stableOverlay.guide.learnMoreLabel}
- <span aria-hidden className="i-ri-arrow-right-up-line size-4" />
- </a>
- )}
- <Button
- variant="primary"
- size="medium"
- className="min-w-20 px-3"
- onClick={stableOverlay.onComplete}
+ )}
+ />
+ <div
+ key={overlay.guide.id}
+ className="transition-opacity duration-200 motion-reduce:transition-none starting:opacity-0"
+ >
+ <div className="pb-0.5 system-2xs-semibold-uppercase text-text-tertiary">
+ {overlay.stepLabel}
+ </div>
+ {isActionGuide ? (
+ <PopoverTitle render={<p />} className="mt-1 system-md-medium text-text-primary">
+ {overlay.guide.description}
+ </PopoverTitle>
+ ) : (
+ <>
+ <PopoverTitle className="mt-1 system-md-medium text-text-primary">
+ {overlay.guide.title}
+ </PopoverTitle>
+ <PopoverDescription className="mt-1 system-xs-regular text-text-secondary">
+ {overlay.guide.description}
+ </PopoverDescription>
+ </>
+ )}
+ </div>
+ <div
+ className={cn(
+ 'mt-auto flex h-12 justify-between gap-3 pt-4',
+ isActionGuide ? 'items-end' : 'items-center',
+ )}
+ >
+ <PopoverClose
+ className="shrink-0 cursor-pointer rounded-md border-none bg-transparent p-0 text-start system-sm-regular text-text-tertiary outline-hidden hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid"
+ onKeyDown={
+ overlay.interactionPolicy === 'target-only' ? handleSkipKeyDown : undefined
+ }
+ >
+ {overlay.skipLabel}
+ </PopoverClose>
+ {!isActionGuide && (
+ <div className="flex shrink-0 items-center gap-1">
+ {overlay.guide.learnMoreHref && (
+ <a
+ href={overlay.guide.learnMoreHref}
+ target="_blank"
+ rel="noopener noreferrer"
+ className={cn(
+ buttonVariants({ variant: 'ghost', size: 'medium' }),
+ 'text-text-tertiary',
+ )}
>
- {stableOverlay.guide.primaryActionLabel}
- </Button>
- </div>
+ {overlay.guide.learnMoreLabel}
+ <span aria-hidden className="i-ri-arrow-right-up-line size-4" />
+ </a>
+ )}
+ <Button
+ ref={primaryActionRef}
+ variant="primary"
+ size="medium"
+ className="min-w-20 px-3"
+ onClick={currentOverlay ? onComplete : undefined}
+ >
+ {overlay.guide.primaryActionLabel}
+ </Button>
</div>
- </>
- )}
- </section>
- </div>
- </>
+ )}
+ </div>
+ </PopoverPopup>
+ </PopoverPositioner>
+ </PopoverPortal>
)}
- </>,
- portalRoot ?? document.body,
+ </Popover>
)
}
diff --git a/web/app/components/step-by-step-tour/floating-widget.tsx b/web/app/components/step-by-step-tour/floating-widget.tsx
index 739e48efe6c..f68d0e3790f 100644
--- a/web/app/components/step-by-step-tour/floating-widget.tsx
+++ b/web/app/components/step-by-step-tour/floating-widget.tsx
@@ -173,7 +173,7 @@ export function MinimizedTourPill({
{...props}
type="button"
className={cn(
- 'inline-flex h-8 w-45.75 max-w-[calc(100vw-16px)] items-center gap-2 overflow-hidden rounded-full border-[0.5px] border-components-panel-border bg-background-section px-3 py-2 text-saas-dify-blue-inverted transition-colors hover:bg-state-base-hover',
+ 'inline-flex h-8 w-45.75 max-w-[calc(100vw-16px)] items-center gap-2 overflow-hidden rounded-full border-[0.5px] border-components-panel-border bg-background-section px-3 py-2 text-saas-dify-blue-inverted transition-[background-color,opacity] hover:bg-state-base-hover motion-reduce:transition-none',
className,
)}
>
@@ -247,26 +247,17 @@ function TourTaskRow({
return (
<div
+ data-status={task.status}
aria-current={current ? 'step' : undefined}
aria-disabled={disabled || undefined}
- className={cn(
- 'group flex w-full gap-1 rounded-xl p-2 transition-colors',
- completed ? 'items-center' : 'items-start',
- current && 'bg-state-base-hover-subtle',
- disabled && 'cursor-not-allowed opacity-60',
- )}
+ className="group flex w-full items-start gap-1 rounded-xl p-2 transition-colors data-[status=completed]:items-center data-[status=current]:bg-state-base-hover-subtle data-[status=disabled]:cursor-not-allowed data-[status=disabled]:opacity-60"
>
- <div className={cn('flex min-w-0 flex-1 gap-3', completed ? 'items-center' : 'items-start')}>
- <div
- className={cn(
- 'flex size-8 shrink-0 items-center justify-center rounded-[10px] border border-components-panel-border-subtle bg-components-panel-bg text-text-accent-light-mode-only',
- completed && 'opacity-50',
- )}
- >
+ <div className="flex min-w-0 flex-1 items-start gap-3 group-data-[status=completed]:items-center">
+ <div className="flex size-8 shrink-0 items-center justify-center rounded-[10px] border border-components-panel-border-subtle bg-components-panel-bg text-text-secondary group-data-[status=completed]:opacity-50 group-data-[status=current]:text-text-accent-light-mode-only">
<span aria-hidden className={cn('size-4', task.iconClassName)} />
</div>
- <div className={cn('min-w-0 flex-1', completed && 'opacity-50')}>
- <div className={cn('system-md-medium text-text-secondary', completed && 'line-through')}>
+ <div className="min-w-0 flex-1 group-data-[status=completed]:opacity-50">
+ <div className="system-md-medium text-text-secondary group-data-[status=completed]:line-through">
{task.title}
</div>
{!completed && (
@@ -333,7 +324,7 @@ function TaskStatusIndicator({
type="button"
aria-label={incompleteLabel}
disabled={disabled}
- className="flex size-4.5 shrink-0 items-center justify-center rounded-full bg-saas-dify-blue-accessible text-text-primary-on-surface outline-hidden hover:bg-saas-dify-blue-inverted focus-visible:ring-2 focus-visible:ring-state-accent-solid disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-saas-dify-blue-accessible"
+ className="flex size-4.5 shrink-0 items-center justify-center rounded-full bg-saas-dify-blue-accessible text-text-primary-on-surface outline-state-accent-solid hover:bg-saas-dify-blue-inverted focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-saas-dify-blue-accessible"
onClick={onUncomplete}
>
<span aria-hidden className="i-ri-check-line size-3" />
@@ -346,7 +337,7 @@ function TaskStatusIndicator({
type="button"
aria-label={completeLabel}
disabled={disabled}
- className="flex size-4.5 shrink-0 items-center justify-center rounded-full border border-components-checkbox-border bg-components-checkbox-bg-unchecked outline-hidden hover:border-state-accent-solid focus-visible:ring-2 focus-visible:ring-state-accent-solid disabled:cursor-not-allowed disabled:hover:border-components-checkbox-border"
+ className="flex size-4.5 shrink-0 items-center justify-center rounded-full border border-components-checkbox-border bg-components-checkbox-bg-unchecked outline-state-accent-solid hover:border-state-accent-solid focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:hover:border-components-checkbox-border"
onClick={onComplete}
/>
)
diff --git a/web/app/components/step-by-step-tour/menu.ts b/web/app/components/step-by-step-tour/menu.ts
index ca03a9af610..5c5dc59e2fd 100644
--- a/web/app/components/step-by-step-tour/menu.ts
+++ b/web/app/components/step-by-step-tour/menu.ts
@@ -1,4 +1,4 @@
-import type { MenuContentProps } from '@langgenius/dify-ui/menu'
+import type { MenuChangeEventDetails, MenuContentProps } from '@langgenius/dify-ui/menu'
import type { SyntheticEvent } from 'react'
import { cn } from '@langgenius/dify-ui/cn'
import { useCallback, useState } from 'react'
@@ -103,10 +103,14 @@ export const useStepByStepTourControlledMenu = ({
if (normalizedState !== state) setState(normalizedState)
const onOpenChange = useCallback(
- (nextOpen: boolean) => {
+ (nextOpen: boolean, eventDetails: Pick<MenuChangeEventDetails, 'reason'>) => {
setState((currentState) => {
const nextState = getNextMenuStateForControlledOpen(currentState, controlledOpen)
- if (nextState.controlledOpen && !allowTriggerCloseWhileControlled && !nextOpen)
+ if (
+ nextState.controlledOpen &&
+ !nextOpen &&
+ (!allowTriggerCloseWhileControlled || eventDetails.reason !== 'trigger-press')
+ )
return nextState
return {
diff --git a/web/app/components/step-by-step-tour/mount.tsx b/web/app/components/step-by-step-tour/mount.tsx
index febefee084c..3ac0f85e3fb 100644
--- a/web/app/components/step-by-step-tour/mount.tsx
+++ b/web/app/components/step-by-step-tour/mount.tsx
@@ -21,9 +21,9 @@ import {
PopoverTrigger,
} from '@langgenius/dify-ui/popover'
import { useSuspenseQuery } from '@tanstack/react-query'
-import { useAtomValue, useSetAtom } from 'jotai'
+import { useAtom, useAtomValue, useSetAtom } from 'jotai'
import { useQueryState } from 'nuqs'
-import { Suspense, useEffect, useRef, useState } from 'react'
+import { Suspense, useEffect, useRef } from 'react'
import { Translation } from 'react-i18next'
import {
pricingQueryParamName,
@@ -56,13 +56,13 @@ import {
resetStepByStepTourSessionAtom,
skipStepByStepTourAtom,
startStepByStepTourTaskAtom,
+ stepByStepTourChecklistMinimizedAtom,
stepByStepTourEnabledForCurrentWorkspaceAtom,
stepByStepTourFirstWorkspaceIdAtom,
stepByStepTourSkippedAtom,
stepByStepTourSkipRecoveryVisibleAtom,
uncompleteStepByStepTourTaskAtom,
} from './state'
-import { useSetStepByStepTourShellMode, useStepByStepTourShellModeValue } from './storage'
import {
getStepByStepTourGuideInteractionPolicy,
getStepByStepTourGuideKind,
@@ -174,18 +174,15 @@ export default function StepByStepTourMount({
const patchSkipTour = useSetAtom(skipStepByStepTourAtom)
const startTask = useSetAtom(startStepByStepTourTaskAtom)
const uncompleteTask = useSetAtom(uncompleteStepByStepTourTaskAtom)
- const shellMode = useStepByStepTourShellModeValue()
- const setShellMode = useSetStepByStepTourShellMode()
- const anchorRef = useRef<HTMLDivElement>(null)
+ const [checklistMinimized, setChecklistMinimized] = useAtom(stepByStepTourChecklistMinimizedAtom)
const checklistCloseButtonRef = useRef<HTMLButtonElement>(null)
const restoreTriggerRef = useRef<HTMLButtonElement>(null)
+ const checklistPopupRef = useRef<HTMLDivElement>(null)
const lastRequestedIntegrationRouteRef = useRef<string | undefined>(undefined)
const previousSkippedRef = useRef(skipped)
const permissionFallbackAnalyticsKeyRef = useRef<string | undefined>(undefined)
const shownAnalyticsKeyRef = useRef<string | undefined>(undefined)
- const skipTimeoutRef = useRef<number | undefined>(undefined)
const stepShownAnalyticsKeyRef = useRef<string | undefined>(undefined)
- const [checklistExiting, setChecklistExiting] = useState(false)
const currentWorkspaceId = currentWorkspace.id
const canCreateApp = hasPermission(workspacePermissionKeys, 'app.create_and_management')
const homeGuideGroup: Extract<StepByStepTourGuideGroup, 'homeNoCreate'> | undefined = canCreateApp
@@ -203,13 +200,6 @@ export default function StepByStepTourMount({
| undefined = isCurrentWorkspaceManager ? undefined : 'integrationLimitedAccess'
const hasIntegrationWalkthroughPermissions = !integrationGuideGroup
- useEffect(
- () => () => {
- if (skipTimeoutRef.current) window.clearTimeout(skipTimeoutRef.current)
- },
- [],
- )
-
const learnDifyEnabled = systemFeatures.enable_learn_app
const stepByStepTourFeatureEnabled = systemFeatures.enable_step_by_step_tour
const availableTasks = learnDifyEnabled
@@ -234,7 +224,7 @@ export default function StepByStepTourMount({
const activeGuideIndex = sessionGuideIndex ?? 0
const activeGuide = activeGuides[activeGuideIndex]
const hasActiveGuide = Boolean(activeTask && activeGuide)
- const minimized = Boolean(activeTask) || shellMode === 'collapsed'
+ const minimized = Boolean(activeTask) || checklistMinimized
const activeGuideIndexes =
activeGuides.length > 0
? getActiveGuideIndexes(activeGuides, sessionGuideIndexes)
@@ -268,14 +258,13 @@ export default function StepByStepTourMount({
!settingsDestination &&
!(pathname === '/apps' && educationExpireNotice)
const completionPromptVisible = visible && allTasksCompleted && !activeTask
- const checklistMinimized = completionPromptVisible ? false : minimized
- const expanded = !checklistMinimized
+ const expanded = completionPromptVisible || !minimized
const activeTargetElement = useStepByStepTourTarget(activeGuide?.target)
const activeGuidePlacement =
activeGuide?.target === STEP_BY_STEP_TOUR_TARGETS.studioEmptyLearnDify
? 'top'
: activeGuide?.target === STEP_BY_STEP_TOUR_TARGETS.integration
- ? 'right'
+ ? 'inline-end'
: 'bottom'
const getPermissionVariant = (taskId: StepByStepTourTaskId) =>
getStepByStepTourPermissionVariant({
@@ -529,21 +518,11 @@ export default function StepByStepTourMount({
})
const skipTour = () => {
- if (checklistExiting) return
-
- setChecklistExiting(true)
-
- skipTimeoutRef.current = window.setTimeout(() => {
- patchSkipTour({
- onSuccess: trackTourSkipped,
- onError: () => {
- setChecklistExiting(false)
- setSkipRecoveryVisible(false)
- },
- })
- setChecklistExiting(false)
- if (recoveryAnchorRef) setSkipRecoveryVisible(true)
- }, 160)
+ patchSkipTour({
+ onSuccess: trackTourSkipped,
+ onError: () => setSkipRecoveryVisible(false),
+ })
+ if (recoveryAnchorRef) setSkipRecoveryVisible(true)
}
const skipActiveGuide = () => {
@@ -557,7 +536,7 @@ export default function StepByStepTourMount({
}
resetSession()
- setShellMode('expanded')
+ setChecklistMinimized(false)
}
const getNextVisibleActiveGuideIndex = (startIndex: number) => {
@@ -616,7 +595,7 @@ export default function StepByStepTourMount({
trackTaskCompleted(completedTaskIds, activeTask.id),
})
resetSession()
- setShellMode('expanded')
+ setChecklistMinimized(false)
return
}
@@ -632,7 +611,7 @@ export default function StepByStepTourMount({
onSuccess: (completedTaskIds) => trackTaskCompleted(completedTaskIds, activeTask.id),
})
resetSession()
- setShellMode('expanded')
+ setChecklistMinimized(false)
}
const dismissCompletedTour = () => {
@@ -640,7 +619,7 @@ export default function StepByStepTourMount({
onSuccess: trackTourSkipped,
})
resetSession()
- setShellMode('expanded')
+ setChecklistMinimized(false)
}
const progress = {
@@ -689,7 +668,7 @@ export default function StepByStepTourMount({
})
}
onMinimize={() => {
- setShellMode('collapsed')
+ setChecklistMinimized(true)
}}
onSkip={skipTour}
onCompleteTask={(taskId) => {
@@ -727,7 +706,7 @@ export default function StepByStepTourMount({
onSuccess: (completedTaskIds) => trackTaskCompleted(completedTaskIds, taskId),
})
resetSession()
- setShellMode('expanded')
+ setChecklistMinimized(false)
return
}
@@ -756,65 +735,74 @@ export default function StepByStepTourMount({
},
})
}}
- className={cn(
- 'transition-opacity duration-150 ease-out motion-reduce:transition-none',
- checklistExiting && 'opacity-0',
- )}
/>
)
return (
<div className={cn('relative', className)}>
- {overlayVisible &&
- !allTasksCompleted &&
- activeTask &&
- activeGuide &&
- activeTargetElement && (
- <StepByStepTourCoachmark
- guide={{
- ...activeGuide,
- description: t(($) => $[activeGuide.description]),
- learnMoreHref: activeGuide.learnMoreDocPath
- ? docLink(activeGuide.learnMoreDocPath)
- : undefined,
- learnMoreLabel: t(($) => $[activeGuide.learnMoreLabel]),
- primaryActionLabel: t(($) => $[activeGuide.primaryActionLabel]),
- title: t(($) => $[activeGuide.title]),
- }}
- targetElement={activeTargetElement}
- placement={activeGuidePlacement}
- stepLabel={t(($) => $['stepByStepTour.stepLabel'], {
- ns: 'onboarding',
- current: activeStepIndex + 1,
- total: activeStepTotal,
- })}
- skipLabel={t(($) => $['stepByStepTour.skip'], { ns: 'onboarding' })}
- interactionPolicy={getStepByStepTourGuideInteractionPolicy(
- activeGuide,
- activeTask.canClickThrough,
- )}
- onSkip={skipActiveGuide}
- onComplete={completeActiveGuide}
- />
- )}
+ {overlayVisible && !allTasksCompleted && activeTask && activeGuide && (
+ <StepByStepTourCoachmark
+ guide={{
+ ...activeGuide,
+ description: t(($) => $[activeGuide.description]),
+ learnMoreHref: activeGuide.learnMoreDocPath
+ ? docLink(activeGuide.learnMoreDocPath)
+ : undefined,
+ learnMoreLabel: t(($) => $[activeGuide.learnMoreLabel]),
+ primaryActionLabel: t(($) => $[activeGuide.primaryActionLabel]),
+ title: t(($) => $[activeGuide.title]),
+ }}
+ targetElement={activeTargetElement}
+ placement={activeGuidePlacement}
+ stepLabel={t(($) => $['stepByStepTour.stepLabel'], {
+ ns: 'onboarding',
+ current: activeStepIndex + 1,
+ total: activeStepTotal,
+ })}
+ skipLabel={t(($) => $['stepByStepTour.skip'], { ns: 'onboarding' })}
+ interactionPolicy={getStepByStepTourGuideInteractionPolicy(
+ activeGuide,
+ activeTask.canClickThrough,
+ )}
+ onSkip={skipActiveGuide}
+ onComplete={completeActiveGuide}
+ />
+ )}
{visible && (!allTasksCompleted || completionPromptVisible) && (
<Popover
open={overlayVisible && expanded}
- onOpenChange={(open) => {
- if (open) setShellMode('expanded')
+ onOpenChange={(open, { event, reason }) => {
+ if (open) {
+ setChecklistMinimized(false)
+ return
+ }
+ // Only the checklist's own keyboard exits minimize it: Escape from inside it or
+ // its trigger, and Tab past it through a focus guard. Outside presses keep it.
+ const target = event.target instanceof Element ? event.target : null
+ const escapedFromChecklist =
+ reason === 'escape-key' &&
+ Boolean(
+ target &&
+ (checklistPopupRef.current?.contains(target) ||
+ restoreTriggerRef.current?.contains(target)),
+ )
+ const tabbedOut =
+ reason === 'focus-out' &&
+ Boolean(target?.hasAttribute('data-base-ui-focus-guard'))
+ if (reason === 'trigger-press' || escapedFromChecklist || tabbedOut)
+ setChecklistMinimized(true)
}}
>
- <div
- ref={anchorRef}
- aria-hidden="true"
- className="pointer-events-none absolute bottom-0 left-0 h-0 w-full"
- />
- {checklistMinimized && (
+ {(!expanded || overlayVisible) && (
<PopoverTrigger
ref={restoreTriggerRef}
- aria-label={t(($) => $['stepByStepTour.restore'], { ns: 'onboarding' })}
render={(props) => (
- <MinimizedTourPill {...props} title={title} progress={progress} />
+ <MinimizedTourPill
+ {...props}
+ className={cn(props.className, 'data-popup-open:opacity-0')}
+ title={title}
+ progress={progress}
+ />
)}
/>
)}
@@ -823,8 +811,8 @@ export default function StepByStepTourMount({
<PopoverPositioner
side="top"
align="start"
- sideOffset={0}
- anchor={anchorRef}
+ // The expanded checklist covers its pill.
+ sideOffset={({ anchor }) => -anchor.height}
collisionPadding={8}
collisionAvoidance={{
side: 'shift',
@@ -833,8 +821,13 @@ export default function StepByStepTourMount({
}}
>
<PopoverPopup
+ ref={checklistPopupRef}
initialFocus={checklistCloseButtonRef}
- finalFocus={restoreTriggerRef}
+ finalFocus={() =>
+ hasActiveGuide && activeTargetElement
+ ? false
+ : restoreTriggerRef.current
+ }
>
{floatingChecklist}
</PopoverPopup>
diff --git a/web/app/components/step-by-step-tour/state.ts b/web/app/components/step-by-step-tour/state.ts
index 594b4588c15..d9aba27e9a8 100644
--- a/web/app/components/step-by-step-tour/state.ts
+++ b/web/app/components/step-by-step-tour/state.ts
@@ -11,6 +11,7 @@ import type {
StepByStepTourSessionState,
StepByStepTourTaskId,
} from './types'
+import { notifyManager } from '@tanstack/react-query'
import { atom } from 'jotai'
import { atomWithMutation, atomWithQuery, queryClientAtom } from 'jotai-tanstack-query'
import { selectAtom } from 'jotai/utils'
@@ -180,6 +181,8 @@ export const activeStepByStepTourGuideIndexesAtom = atom(
export const stepByStepTourSkipRecoveryVisibleAtom = atom(false)
+export const stepByStepTourChecklistMinimizedAtom = atom(false)
+
export const startStepByStepTourTaskAtom = atom(
null,
(
@@ -334,6 +337,9 @@ const patchStepByStepTourState = async (
}
queryClient.setQueryData(stepByStepTourStateQueryKey(), state)
+ // The query atom receives the saved state through a scheduled notification; dropping the
+ // optimistic command before it lands would show the previous state for a render.
+ await new Promise<void>((resolve) => notifyManager.schedule(resolve))
const reconciliation = settleStepByStepTourStateCommand(get, set, queryClient, command)
options?.onSuccess?.(
state.completed_task_ids?.filter((taskId): taskId is StepByStepTourTaskId => Boolean(taskId)) ??
diff --git a/web/app/components/step-by-step-tour/storage.ts b/web/app/components/step-by-step-tour/storage.ts
deleted file mode 100644
index fb16e19fdeb..00000000000
--- a/web/app/components/step-by-step-tour/storage.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-'use client'
-
-import { createLocalStorageState } from 'foxact/create-local-storage-state'
-
-type StepByStepTourShellMode = 'expanded' | 'collapsed'
-
-export const STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY = 'step-by-step-tour-shell-mode'
-
-const [
- _useStepByStepTourShellMode,
- useStepByStepTourShellModeValue,
- useSetStepByStepTourShellMode,
-] = createLocalStorageState<StepByStepTourShellMode>(
- STEP_BY_STEP_TOUR_SHELL_MODE_STORAGE_KEY,
- 'expanded',
- { raw: true },
-)
-
-export { useSetStepByStepTourShellMode, useStepByStepTourShellModeValue }
diff --git a/web/app/components/step-by-step-tour/target-registry.ts b/web/app/components/step-by-step-tour/target-registry.ts
index 1ffbe7a6030..1fd5f30509f 100644
--- a/web/app/components/step-by-step-tour/target-registry.ts
+++ b/web/app/components/step-by-step-tour/target-registry.ts
@@ -57,8 +57,6 @@ export type StepByStepTourGuideKind = 'action' | 'walkthrough'
export type StepByStepTourGuideInteractionPolicy = 'blocked' | 'target-only'
-type StepByStepTourGuidePortalOrder = 'afterOverlays'
-
export type StepByStepTourGuide = {
id: string
taskId: StepByStepTourTaskId
@@ -74,7 +72,6 @@ export type StepByStepTourGuide = {
integrationSection?: IntegrationSection
learnMoreDocPath?: DocPathWithoutLang
optional?: boolean
- portalOrder?: StepByStepTourGuidePortalOrder
}
export function getStepByStepTourGuideKind(
@@ -290,7 +287,6 @@ const STEP_BY_STEP_TOUR_GUIDES: Partial<Record<StepByStepTourTaskId, StepByStepT
completionMode: 'external',
kind: 'action',
interactionPolicy: 'target-only',
- portalOrder: 'afterOverlays',
},
],
integration: [
diff --git a/web/app/components/step-by-step-tour/use-coachmark-position.ts b/web/app/components/step-by-step-tour/use-coachmark-position.ts
deleted file mode 100644
index 8010f030237..00000000000
--- a/web/app/components/step-by-step-tour/use-coachmark-position.ts
+++ /dev/null
@@ -1,157 +0,0 @@
-'use client'
-
-import type { CSSProperties } from 'react'
-import type { StepByStepTourTargetRect } from './use-target-rect'
-import { useLayoutEffect, useState } from 'react'
-
-const BUBBLE_WIDTH = 352
-const BUBBLE_HEIGHT = 158
-const BUBBLE_SIDE_OFFSET = 20
-const VIEWPORT_PADDING = 8
-const FIGMA_ARROW_FRAME_LEFT = 28
-const FIGMA_ARROW_DOT_CENTER_X = 1
-const MIN_ARROW_LEFT = 12
-const MAX_ARROW_RIGHT_PADDING = 12
-
-type ViewportSize = {
- height: number
- width: number
-}
-
-export type StepByStepTourCoachmarkSize = {
- height: number
- width: number
-}
-
-type CoachmarkPosition = {
- arrowStyle: CSSProperties
- bubbleStyle: CSSProperties
- placement: StepByStepTourCoachmarkPlacement
-}
-
-export type StepByStepTourCoachmarkPlacement = 'bottom' | 'right' | 'top'
-
-const getViewportSize = (): ViewportSize => ({
- height: window.innerHeight,
- width: window.innerWidth,
-})
-
-const clamp = (value: number, min: number, max: number) => {
- return Math.min(Math.max(value, min), max)
-}
-
-const getStepByStepTourCoachmarkPosition = (
- placementRect: StepByStepTourTargetRect,
- viewportSize: ViewportSize,
- placement: StepByStepTourCoachmarkPlacement = 'bottom',
- anchorRect: StepByStepTourTargetRect = placementRect,
- bubbleSize: StepByStepTourCoachmarkSize = {
- height: BUBBLE_HEIGHT,
- width: BUBBLE_WIDTH,
- },
-): CoachmarkPosition => {
- if (placement === 'right') {
- const maxBubbleLeft = viewportSize.width - bubbleSize.width - VIEWPORT_PADDING
- const bubbleLeft = clamp(
- placementRect.left + placementRect.width + BUBBLE_SIDE_OFFSET,
- VIEWPORT_PADDING,
- Math.max(VIEWPORT_PADDING, maxBubbleLeft),
- )
- const maxBubbleTop = viewportSize.height - bubbleSize.height - VIEWPORT_PADDING
- const preferredBubbleTop = anchorRect.top + (anchorRect.height - bubbleSize.height) / 2
- const bubbleTop = clamp(
- preferredBubbleTop,
- VIEWPORT_PADDING,
- Math.max(VIEWPORT_PADDING, maxBubbleTop),
- )
-
- return {
- arrowStyle: {
- top: anchorRect.top + anchorRect.height / 2 - bubbleTop,
- },
- bubbleStyle: {
- left: bubbleLeft,
- top: bubbleTop,
- },
- placement,
- }
- }
-
- const maxBubbleLeft = viewportSize.width - bubbleSize.width - VIEWPORT_PADDING
- const bubbleLeft = clamp(
- placementRect.left,
- VIEWPORT_PADDING,
- Math.max(VIEWPORT_PADDING, maxBubbleLeft),
- )
- const maxBubbleTop = viewportSize.height - bubbleSize.height - VIEWPORT_PADDING
- const bottomBubbleTop = placementRect.top + placementRect.height + BUBBLE_SIDE_OFFSET
- const topBubbleTop = placementRect.top - bubbleSize.height - BUBBLE_SIDE_OFFSET
- const hasBottomRoom =
- bottomBubbleTop + bubbleSize.height <= viewportSize.height - VIEWPORT_PADDING
- const hasTopRoom = topBubbleTop >= VIEWPORT_PADDING
- const spaceBelow = viewportSize.height - VIEWPORT_PADDING - bottomBubbleTop
- const spaceAbove = placementRect.top - VIEWPORT_PADDING - BUBBLE_SIDE_OFFSET
- const resolvedPlacement =
- placement === 'bottom'
- ? !hasBottomRoom && (hasTopRoom || spaceAbove > spaceBelow)
- ? 'top'
- : 'bottom'
- : !hasTopRoom && (hasBottomRoom || spaceBelow > spaceAbove)
- ? 'bottom'
- : 'top'
- const preferredBubbleTop =
- resolvedPlacement === 'top'
- ? placementRect.top - bubbleSize.height - BUBBLE_SIDE_OFFSET
- : placementRect.top + placementRect.height + BUBBLE_SIDE_OFFSET
- const bubbleTop = clamp(
- preferredBubbleTop,
- VIEWPORT_PADDING,
- Math.max(VIEWPORT_PADDING, maxBubbleTop),
- )
- const targetAnchorX = anchorRect.left + FIGMA_ARROW_FRAME_LEFT + FIGMA_ARROW_DOT_CENTER_X
- const arrowLeft = clamp(
- targetAnchorX - bubbleLeft - FIGMA_ARROW_DOT_CENTER_X,
- MIN_ARROW_LEFT,
- bubbleSize.width - MAX_ARROW_RIGHT_PADDING,
- )
-
- return {
- arrowStyle: {
- left: arrowLeft,
- },
- bubbleStyle: {
- left: bubbleLeft,
- top: bubbleTop,
- },
- placement: resolvedPlacement,
- }
-}
-
-export const useStepByStepTourCoachmarkPosition = (
- placementRect: StepByStepTourTargetRect,
- placement: StepByStepTourCoachmarkPlacement = 'bottom',
- anchorRect: StepByStepTourTargetRect = placementRect,
- bubbleSize?: StepByStepTourCoachmarkSize,
-) => {
- const [viewportSize, setViewportSize] = useState<ViewportSize>(() => getViewportSize())
-
- useLayoutEffect(() => {
- const syncViewportSize = () => {
- setViewportSize(getViewportSize())
- }
-
- window.addEventListener('resize', syncViewportSize)
-
- return () => {
- window.removeEventListener('resize', syncViewportSize)
- }
- }, [])
-
- return getStepByStepTourCoachmarkPosition(
- placementRect,
- viewportSize,
- placement,
- anchorRect,
- bubbleSize,
- )
-}
diff --git a/web/app/components/step-by-step-tour/use-target-rect.ts b/web/app/components/step-by-step-tour/use-target-rect.ts
index 3390dc12d24..a2bb4fcb152 100644
--- a/web/app/components/step-by-step-tour/use-target-rect.ts
+++ b/web/app/components/step-by-step-tour/use-target-rect.ts
@@ -135,15 +135,18 @@ const areMeasuredTargetRectSetsEqual = (
}
export const useStepByStepTourTargetRect = (
- targetElement: HTMLElement,
+ targetElement: HTMLElement | null,
highlightPartSelectors: string[] = EMPTY_HIGHLIGHT_PART_SELECTORS,
) => {
- const [targetRects, setTargetRects] = useState(() =>
- getInitialTargetRects(targetElement, highlightPartSelectors),
+ const [targetRects, setTargetRects] = useState<StepByStepTourTargetRects | null>(() =>
+ targetElement ? getInitialTargetRects(targetElement, highlightPartSelectors) : null,
)
const targetRectsRef = useRef(targetRects)
useLayoutEffect(() => {
+ if (!targetElement) return
+ const target = targetElement
+
let animationFrame = 0
let resizeObserver: ResizeObserver | undefined
let mutationObserver: MutationObserver | undefined
@@ -178,7 +181,7 @@ export const useStepByStepTourTargetRect = (
const highlightPartElements = getElementsBySelectors(highlightPartSelectors)
highlightPartElements.forEach(observeHighlightPart)
- const nextMeasuredRects = getTargetRects(targetElement, highlightPartSelectors)
+ const nextMeasuredRects = getTargetRects(target, highlightPartSelectors)
if (highlightPartSelectors.length === 0) {
previousMeasuredRects = nextMeasuredRects
settleFrameCount = 0
@@ -223,7 +226,8 @@ export const useStepByStepTourTargetRect = (
}
function commitTargetRects(nextRects: StepByStepTourTargetRects) {
- if (areTargetRectSetsEqual(targetRectsRef.current, nextRects)) return
+ if (targetRectsRef.current && areTargetRectSetsEqual(targetRectsRef.current, nextRects))
+ return
targetRectsRef.current = nextRects
setTargetRects(nextRects)
@@ -237,7 +241,7 @@ export const useStepByStepTourTargetRect = (
resizeObserver =
typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(scheduleSyncRect)
- observeResizeElement(targetElement)
+ observeResizeElement(target)
mutationObserver =
typeof MutationObserver === 'undefined' ? undefined : new MutationObserver(scheduleSyncRect)
@@ -245,7 +249,7 @@ export const useStepByStepTourTargetRect = (
childList: true,
subtree: true,
})
- observeAttributeElement(targetElement)
+ observeAttributeElement(target)
window.addEventListener('resize', scheduleSyncRect)
window.addEventListener('scroll', scheduleSyncRect, true)
@@ -261,5 +265,5 @@ export const useStepByStepTourTargetRect = (
}
}, [highlightPartSelectors, targetElement])
- return targetRects
+ return targetElement ? targetRects : null
}
diff --git a/web/i18n/locales/ar-TN/onboarding.json b/web/i18n/locales/ar-TN/onboarding.json
index 17c45b62063..62d315f4e03 100644
--- a/web/i18n/locales/ar-TN/onboarding.json
+++ b/web/i18n/locales/ar-TN/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "وضع علامة على {{title}} كغير مكتمل",
"stepByStepTour.minimize": "تصغير",
"stepByStepTour.progressAriaValueText": "اكتملت {{completed}} من {{total}} خطوات",
- "stepByStepTour.restore": "فتح الجولة خطوة بخطوة",
"stepByStepTour.skip": "تخطي الجولة",
"stepByStepTour.skipRecovery.dismiss": "فهمت",
"stepByStepTour.skipRecovery.label": "تلميح استعادة Step-by-step Tour",
diff --git a/web/i18n/locales/az-AZ/onboarding.json b/web/i18n/locales/az-AZ/onboarding.json
index a5496ae4d07..bd350a8cd56 100644
--- a/web/i18n/locales/az-AZ/onboarding.json
+++ b/web/i18n/locales/az-AZ/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "«{{title}}» tapşırığını tamamlanmamış kimi işarələ",
"stepByStepTour.minimize": "Kiçilt",
"stepByStepTour.progressAriaValueText": "{{total}} addımdan {{completed}} addım tamamlanıb",
- "stepByStepTour.restore": "Addım-addım tanışlığı aç",
"stepByStepTour.skip": "Tanışlığı ötür",
"stepByStepTour.skipRecovery.dismiss": "Aydındır",
"stepByStepTour.skipRecovery.label": "Addım-addım tanışlığın bərpası üçün məsləhət",
diff --git a/web/i18n/locales/de-DE/onboarding.json b/web/i18n/locales/de-DE/onboarding.json
index d382300cf67..017b21f4b16 100644
--- a/web/i18n/locales/de-DE/onboarding.json
+++ b/web/i18n/locales/de-DE/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "{{title}} als nicht abgeschlossen markieren",
"stepByStepTour.minimize": "Minimieren",
"stepByStepTour.progressAriaValueText": "{{completed}} von {{total}} Schritten abgeschlossen",
- "stepByStepTour.restore": "Step-by-step Tour öffnen",
"stepByStepTour.skip": "Tour überspringen",
"stepByStepTour.skipRecovery.dismiss": "Verstanden",
"stepByStepTour.skipRecovery.label": "Hinweis zum Wiederherstellen der Step-by-step Tour",
diff --git a/web/i18n/locales/en-US/onboarding.json b/web/i18n/locales/en-US/onboarding.json
index 201cf0d0b7b..bd34809b982 100644
--- a/web/i18n/locales/en-US/onboarding.json
+++ b/web/i18n/locales/en-US/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Mark {{title}} incomplete",
"stepByStepTour.minimize": "Minimize",
"stepByStepTour.progressAriaValueText": "{{completed}} of {{total}} steps completed",
- "stepByStepTour.restore": "Open step-by-step tour",
"stepByStepTour.skip": "Skip tour",
"stepByStepTour.skipRecovery.dismiss": "Got it",
"stepByStepTour.skipRecovery.label": "Step-by-step Tour recovery tip",
diff --git a/web/i18n/locales/es-ES/onboarding.json b/web/i18n/locales/es-ES/onboarding.json
index ee65d08c8e5..2c58d4b7bbb 100644
--- a/web/i18n/locales/es-ES/onboarding.json
+++ b/web/i18n/locales/es-ES/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Marcar {{title}} como incompleto",
"stepByStepTour.minimize": "Minimizar",
"stepByStepTour.progressAriaValueText": "{{completed}} de {{total}} pasos completados",
- "stepByStepTour.restore": "Abrir el recorrido paso a paso",
"stepByStepTour.skip": "Omitir recorrido",
"stepByStepTour.skipRecovery.dismiss": "Entendido",
"stepByStepTour.skipRecovery.label": "Consejo para recuperar el Step-by-step Tour",
diff --git a/web/i18n/locales/fa-IR/onboarding.json b/web/i18n/locales/fa-IR/onboarding.json
index 401f0bb9b62..b2b19185b1e 100644
--- a/web/i18n/locales/fa-IR/onboarding.json
+++ b/web/i18n/locales/fa-IR/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "{{title}} را ناقص علامت بزن",
"stepByStepTour.minimize": "کوچک کردن",
"stepByStepTour.progressAriaValueText": "{{completed}} از {{total}} مرحله کامل شد",
- "stepByStepTour.restore": "باز کردن تور گام‌به‌گام",
"stepByStepTour.skip": "رد کردن تور",
"stepByStepTour.skipRecovery.dismiss": "متوجه شدم",
"stepByStepTour.skipRecovery.label": "نکته بازیابی Step-by-step Tour",
diff --git a/web/i18n/locales/fr-FR/onboarding.json b/web/i18n/locales/fr-FR/onboarding.json
index cb54c06580d..8d25529a254 100644
--- a/web/i18n/locales/fr-FR/onboarding.json
+++ b/web/i18n/locales/fr-FR/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Marquer {{title}} comme non terminé",
"stepByStepTour.minimize": "Réduire",
"stepByStepTour.progressAriaValueText": "{{completed}} étapes sur {{total}} terminées",
- "stepByStepTour.restore": "Ouvrir la visite étape par étape",
"stepByStepTour.skip": "Passer la visite",
"stepByStepTour.skipRecovery.dismiss": "Compris",
"stepByStepTour.skipRecovery.label": "Conseil de récupération du Step-by-step Tour",
diff --git a/web/i18n/locales/hi-IN/onboarding.json b/web/i18n/locales/hi-IN/onboarding.json
index 61792be6617..b54986133e0 100644
--- a/web/i18n/locales/hi-IN/onboarding.json
+++ b/web/i18n/locales/hi-IN/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "{{title}} को अधूरा चिह्नित करें",
"stepByStepTour.minimize": "छोटा करें",
"stepByStepTour.progressAriaValueText": "{{total}} में से {{completed}} चरण पूरे हुए",
- "stepByStepTour.restore": "Step-by-step टूर खोलें",
"stepByStepTour.skip": "टूर छोड़ें",
"stepByStepTour.skipRecovery.dismiss": "समझ गए",
"stepByStepTour.skipRecovery.label": "Step-by-step Tour रिकवरी टिप",
diff --git a/web/i18n/locales/id-ID/onboarding.json b/web/i18n/locales/id-ID/onboarding.json
index b081425a67e..0a4fa28462b 100644
--- a/web/i18n/locales/id-ID/onboarding.json
+++ b/web/i18n/locales/id-ID/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Tandai {{title}} belum selesai",
"stepByStepTour.minimize": "Perkecil",
"stepByStepTour.progressAriaValueText": "{{completed}} dari {{total}} langkah selesai",
- "stepByStepTour.restore": "Buka tur langkah demi langkah",
"stepByStepTour.skip": "Lewati tur",
"stepByStepTour.skipRecovery.dismiss": "Mengerti",
"stepByStepTour.skipRecovery.label": "Tip pemulihan Step-by-step Tour",
diff --git a/web/i18n/locales/it-IT/onboarding.json b/web/i18n/locales/it-IT/onboarding.json
index 81f33cc9f59..6f86c1a6fa8 100644
--- a/web/i18n/locales/it-IT/onboarding.json
+++ b/web/i18n/locales/it-IT/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Contrassegna {{title}} come incompleto",
"stepByStepTour.minimize": "Riduci a icona",
"stepByStepTour.progressAriaValueText": "{{completed}} di {{total}} passaggi completati",
- "stepByStepTour.restore": "Apri lo step-by-step tour",
"stepByStepTour.skip": "Salta il tour",
"stepByStepTour.skipRecovery.dismiss": "Ho capito",
"stepByStepTour.skipRecovery.label": "Suggerimento di ripristino dello Step-by-step Tour",
diff --git a/web/i18n/locales/ja-JP/onboarding.json b/web/i18n/locales/ja-JP/onboarding.json
index 5b8e5662193..8e5d3360db3 100644
--- a/web/i18n/locales/ja-JP/onboarding.json
+++ b/web/i18n/locales/ja-JP/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "{{title}} を未完了としてマーク",
"stepByStepTour.minimize": "最小化",
"stepByStepTour.progressAriaValueText": "{{total}} ステップ中 {{completed}} 完了",
- "stepByStepTour.restore": "Step-by-step Tour を開く",
"stepByStepTour.skip": "ガイドをスキップ",
"stepByStepTour.skipRecovery.dismiss": "了解",
"stepByStepTour.skipRecovery.label": "Step-by-step Tour の復元ヒント",
diff --git a/web/i18n/locales/ko-KR/onboarding.json b/web/i18n/locales/ko-KR/onboarding.json
index 0318c9f3169..7a0ac053be9 100644
--- a/web/i18n/locales/ko-KR/onboarding.json
+++ b/web/i18n/locales/ko-KR/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "{{title}} 미완료로 표시",
"stepByStepTour.minimize": "최소화",
"stepByStepTour.progressAriaValueText": "{{total}}단계 중 {{completed}}개 완료",
- "stepByStepTour.restore": "Step-by-step Tour 열기",
"stepByStepTour.skip": "둘러보기 건너뛰기",
"stepByStepTour.skipRecovery.dismiss": "확인",
"stepByStepTour.skipRecovery.label": "Step-by-step Tour 복구 팁",
diff --git a/web/i18n/locales/lo-LA/onboarding.json b/web/i18n/locales/lo-LA/onboarding.json
index a3d96e6a282..1c4c2da8955 100644
--- a/web/i18n/locales/lo-LA/onboarding.json
+++ b/web/i18n/locales/lo-LA/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "ໝາຍ {{title}} ວ່າບໍ່ທັນສຳເລັດ",
"stepByStepTour.minimize": "ຫຍໍ້ໜ້າຕ່າງ",
"stepByStepTour.progressAriaValueText": "ສຳເລັດ {{completed}} ຈາກ {{total}} ຂັ້ນຕອນ",
- "stepByStepTour.restore": "ເປີດການແນະນຳເທື່ອລະຂັ້ນຕອນ",
"stepByStepTour.skip": "ຂ້າມການແນະນຳ",
"stepByStepTour.skipRecovery.dismiss": "ຮັບຊາບແລ້ວ",
"stepByStepTour.skipRecovery.label": "ຄຳແນະນຳການກູ້ຄືນການແນະນຳເທື່ອລະຂັ້ນຕອນ",
diff --git a/web/i18n/locales/nl-NL/onboarding.json b/web/i18n/locales/nl-NL/onboarding.json
index fdb8db61c8c..ceeb9c91e14 100644
--- a/web/i18n/locales/nl-NL/onboarding.json
+++ b/web/i18n/locales/nl-NL/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "{{title}} als onvoltooid markeren",
"stepByStepTour.minimize": "Minimaliseren",
"stepByStepTour.progressAriaValueText": "{{completed}} van {{total}} stappen voltooid",
- "stepByStepTour.restore": "Stapsgewijze rondleiding openen",
"stepByStepTour.skip": "Rondleiding overslaan",
"stepByStepTour.skipRecovery.dismiss": "Begrepen",
"stepByStepTour.skipRecovery.label": "Hersteltip voor Step-by-step Tour",
diff --git a/web/i18n/locales/pl-PL/onboarding.json b/web/i18n/locales/pl-PL/onboarding.json
index 0d715ef43bd..3a0d8ae6c02 100644
--- a/web/i18n/locales/pl-PL/onboarding.json
+++ b/web/i18n/locales/pl-PL/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Oznacz {{title}} jako nieukończone",
"stepByStepTour.minimize": "Zminimalizuj",
"stepByStepTour.progressAriaValueText": "Ukończono {{completed}} z {{total}} kroków",
- "stepByStepTour.restore": "Otwórz przewodnik krok po kroku",
"stepByStepTour.skip": "Pomiń przewodnik",
"stepByStepTour.skipRecovery.dismiss": "Rozumiem",
"stepByStepTour.skipRecovery.label": "Wskazówka przywracania Step-by-step Tour",
diff --git a/web/i18n/locales/pt-BR/onboarding.json b/web/i18n/locales/pt-BR/onboarding.json
index 9587d561093..09058dccceb 100644
--- a/web/i18n/locales/pt-BR/onboarding.json
+++ b/web/i18n/locales/pt-BR/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Marcar {{title}} como incompleto",
"stepByStepTour.minimize": "Minimizar",
"stepByStepTour.progressAriaValueText": "{{completed}} de {{total}} etapas concluídas",
- "stepByStepTour.restore": "Abrir o tour passo a passo",
"stepByStepTour.skip": "Pular tour",
"stepByStepTour.skipRecovery.dismiss": "Entendi",
"stepByStepTour.skipRecovery.label": "Dica de recuperação do Step-by-step Tour",
diff --git a/web/i18n/locales/ro-RO/onboarding.json b/web/i18n/locales/ro-RO/onboarding.json
index 4302ff5d1db..0c290272933 100644
--- a/web/i18n/locales/ro-RO/onboarding.json
+++ b/web/i18n/locales/ro-RO/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Marchează {{title}} ca nefinalizat",
"stepByStepTour.minimize": "Minimizează",
"stepByStepTour.progressAriaValueText": "{{completed}} din {{total}} pași finalizați",
- "stepByStepTour.restore": "Deschide turul pas cu pas",
"stepByStepTour.skip": "Omite turul",
"stepByStepTour.skipRecovery.dismiss": "Am înțeles",
"stepByStepTour.skipRecovery.label": "Sfat de recuperare pentru Step-by-step Tour",
diff --git a/web/i18n/locales/ru-RU/onboarding.json b/web/i18n/locales/ru-RU/onboarding.json
index ee5c15ab2f3..49733136c7f 100644
--- a/web/i18n/locales/ru-RU/onboarding.json
+++ b/web/i18n/locales/ru-RU/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Отметить {{title}} как невыполненное",
"stepByStepTour.minimize": "Свернуть",
"stepByStepTour.progressAriaValueText": "Выполнено {{completed}} из {{total}} шагов",
- "stepByStepTour.restore": "Открыть пошаговый тур",
"stepByStepTour.skip": "Пропустить тур",
"stepByStepTour.skipRecovery.dismiss": "Понятно",
"stepByStepTour.skipRecovery.label": "Подсказка по восстановлению Step-by-step Tour",
diff --git a/web/i18n/locales/sl-SI/onboarding.json b/web/i18n/locales/sl-SI/onboarding.json
index b2f503eb58a..21967dbc0a3 100644
--- a/web/i18n/locales/sl-SI/onboarding.json
+++ b/web/i18n/locales/sl-SI/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Označi {{title}} kot nedokončano",
"stepByStepTour.minimize": "Pomanjšaj",
"stepByStepTour.progressAriaValueText": "Dokončanih {{completed}} od {{total}} korakov",
- "stepByStepTour.restore": "Odpri vodnik po korakih",
"stepByStepTour.skip": "Preskoči vodnik",
"stepByStepTour.skipRecovery.dismiss": "Razumem",
"stepByStepTour.skipRecovery.label": "Namig za obnovitev Step-by-step Tour",
diff --git a/web/i18n/locales/th-TH/onboarding.json b/web/i18n/locales/th-TH/onboarding.json
index 7d7c1b07f89..da018f85a22 100644
--- a/web/i18n/locales/th-TH/onboarding.json
+++ b/web/i18n/locales/th-TH/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "ทำเครื่องหมาย {{title}} ว่ายังไม่เสร็จ",
"stepByStepTour.minimize": "ย่อ",
"stepByStepTour.progressAriaValueText": "เสร็จแล้ว {{completed}} จาก {{total}} ขั้นตอน",
- "stepByStepTour.restore": "เปิด Step-by-step Tour",
"stepByStepTour.skip": "ข้ามทัวร์",
"stepByStepTour.skipRecovery.dismiss": "เข้าใจแล้ว",
"stepByStepTour.skipRecovery.label": "เคล็ดลับการกู้คืน Step-by-step Tour",
diff --git a/web/i18n/locales/tr-TR/onboarding.json b/web/i18n/locales/tr-TR/onboarding.json
index 2353a988ba3..e2401be02f4 100644
--- a/web/i18n/locales/tr-TR/onboarding.json
+++ b/web/i18n/locales/tr-TR/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "{{title}} tamamlanmadı olarak işaretle",
"stepByStepTour.minimize": "Küçült",
"stepByStepTour.progressAriaValueText": "{{total}} adımdan {{completed}} tamamlandı",
- "stepByStepTour.restore": "Adım adım turu aç",
"stepByStepTour.skip": "Turu atla",
"stepByStepTour.skipRecovery.dismiss": "Anladım",
"stepByStepTour.skipRecovery.label": "Step-by-step Tour kurtarma ipucu",
diff --git a/web/i18n/locales/uk-UA/onboarding.json b/web/i18n/locales/uk-UA/onboarding.json
index f5c956e1510..2804809dd5d 100644
--- a/web/i18n/locales/uk-UA/onboarding.json
+++ b/web/i18n/locales/uk-UA/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Позначити {{title}} як невиконане",
"stepByStepTour.minimize": "Згорнути",
"stepByStepTour.progressAriaValueText": "Виконано {{completed}} з {{total}} кроків",
- "stepByStepTour.restore": "Відкрити покроковий тур",
"stepByStepTour.skip": "Пропустити тур",
"stepByStepTour.skipRecovery.dismiss": "Зрозуміло",
"stepByStepTour.skipRecovery.label": "Порада щодо відновлення Step-by-step Tour",
diff --git a/web/i18n/locales/vi-VN/onboarding.json b/web/i18n/locales/vi-VN/onboarding.json
index 108e080c659..f836020f30c 100644
--- a/web/i18n/locales/vi-VN/onboarding.json
+++ b/web/i18n/locales/vi-VN/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "Đánh dấu {{title}} là chưa hoàn thành",
"stepByStepTour.minimize": "Thu nhỏ",
"stepByStepTour.progressAriaValueText": "Đã hoàn thành {{completed}} / {{total}} bước",
- "stepByStepTour.restore": "Mở hướng dẫn từng bước",
"stepByStepTour.skip": "Bỏ qua hướng dẫn",
"stepByStepTour.skipRecovery.dismiss": "Đã hiểu",
"stepByStepTour.skipRecovery.label": "Mẹo khôi phục Step-by-step Tour",
diff --git a/web/i18n/locales/zh-Hans/onboarding.json b/web/i18n/locales/zh-Hans/onboarding.json
index a4e31c6cba5..2a7fbcc7ab6 100644
--- a/web/i18n/locales/zh-Hans/onboarding.json
+++ b/web/i18n/locales/zh-Hans/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "将 {{title}} 标记为未完成",
"stepByStepTour.minimize": "最小化",
"stepByStepTour.progressAriaValueText": "已完成 {{completed}} / {{total}} 个步骤",
- "stepByStepTour.restore": "打开 Step-by-step Tour",
"stepByStepTour.skip": "跳过引导",
"stepByStepTour.skipRecovery.dismiss": "知道了",
"stepByStepTour.skipRecovery.label": "Step-by-step Tour 恢复提示",
diff --git a/web/i18n/locales/zh-Hant/onboarding.json b/web/i18n/locales/zh-Hant/onboarding.json
index 48d5b17683b..7a6af693cb9 100644
--- a/web/i18n/locales/zh-Hant/onboarding.json
+++ b/web/i18n/locales/zh-Hant/onboarding.json
@@ -57,7 +57,6 @@
"stepByStepTour.markTaskIncomplete": "將 {{title}} 標記為未完成",
"stepByStepTour.minimize": "最小化",
"stepByStepTour.progressAriaValueText": "已完成 {{completed}} / {{total}} 個步驟",
- "stepByStepTour.restore": "開啟 Step-by-step Tour",
"stepByStepTour.skip": "略過導覽",
"stepByStepTour.skipRecovery.dismiss": "知道了",
"stepByStepTour.skipRecovery.label": "Step-by-step Tour 復原提示",
diff --git a/web/i18n/resources.generated.d.ts b/web/i18n/resources.generated.d.ts
index 73cd9713158..25fe27ee3fc 100644
--- a/web/i18n/resources.generated.d.ts
+++ b/web/i18n/resources.generated.d.ts
@@ -4182,7 +4182,6 @@ export default interface Resources {
'stepByStepTour.markTaskIncomplete': 'Mark {{title}} incomplete'
'stepByStepTour.minimize': 'Minimize'
'stepByStepTour.progressAriaValueText': '{{completed}} of {{total}} steps completed'
- 'stepByStepTour.restore': 'Open step-by-step tour'
'stepByStepTour.skip': 'Skip tour'
'stepByStepTour.skipRecovery.dismiss': 'Got it'
'stepByStepTour.skipRecovery.label': 'Step-by-step Tour recovery tip'