Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(webv2): show feature hints on generate and upscale fields
joshistoast0730324f1e4d
diff --git a/invokeai/frontend/webv2/src/app/App.tsx b/invokeai/frontend/webv2/src/app/App.tsxindex d820540b4b..268f620404 100644--- a/invokeai/frontend/webv2/src/app/App.tsx+++ b/invokeai/frontend/webv2/src/app/App.tsx@@ -4,6 +4,7 @@ import { AppToaster } from '@platform/ui/toaster';import { RouterProvider } from '@tanstack/react-router';import { system } from '@theme/system';+import { FeatureHintsAdapterProvider } from './FeatureHintsProvider';import { I18nController } from './I18nController';import { router } from './router';import { ThemeController } from './ThemeController';@@ -14,7 +15,9 @@ export const App = () => (<ThemeController /><I18nController /><AppToaster />- <RouterProvider router={router} />+ <FeatureHintsAdapterProvider>+ <RouterProvider router={router} />+ </FeatureHintsAdapterProvider></ChakraProvider></AppProviders>);diff --git a/invokeai/frontend/webv2/src/app/FeatureHintsProvider.tsx b/invokeai/frontend/webv2/src/app/FeatureHintsProvider.tsxnew file mode 100644index 0000000000..3f2a1d4c28--- /dev/null+++ b/invokeai/frontend/webv2/src/app/FeatureHintsProvider.tsx@@ -0,0 +1,29 @@+import type { FeatureHintsAdapter } from '@platform/ui/hints';+import type { ReactNode } from 'react';++import { FeatureHintsProvider } from '@platform/ui/hints';+import { toaster } from '@platform/ui/toaster';+import { patchWorkbenchPreferences, useWorkbenchPreferenceSelector } from '@workbench/settings/store';+import { useCallback, useMemo } from 'react';+import { useTranslation } from 'react-i18next';++/**+ * Production binding of the feature-hints port. Platform may not read Workbench+ * preferences, so App supplies both the enabled flag and the write that the+ * card's "don't show me these" action needs.+ */+export const FeatureHintsAdapterProvider = ({ children }: { children: ReactNode }) => {+ const { t } = useTranslation();+ const enabled = useWorkbenchPreferenceSelector((preferences) => preferences.enableInformationalPopovers);+ const onDisable = useCallback(() => {+ void patchWorkbenchPreferences({ enableInformationalPopovers: false });+ toaster.create({+ description: t('settings.informationalPopoversDisabledDesc'),+ title: t('settings.informationalPopoversDisabled'),+ type: 'info',+ });+ }, [t]);+ const adapter = useMemo<FeatureHintsAdapter>(() => ({ enabled, onDisable }), [enabled, onDisable]);++ return <FeatureHintsProvider adapter={adapter}>{children}</FeatureHintsProvider>;+};diff --git a/invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx b/invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsxindex 63dad0e808..e180da7ed3 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateAdvancedFields.tsx@@ -133,6 +133,7 @@ export const GenerateAdvancedFields = ({{policy.sdVaeVisible ? (<Fieldflex="2"+ hint="vae"label={t('widgets.generate.vae')}helpText={settings.vae ? undefined : t('widgets.generate.usingBundledVae')}>@@ -155,7 +156,7 @@ export const GenerateAdvancedFields = ({</Field>) : null}{policy.vaePrecisionVisible ? (- <Field flex="1" label={t('widgets.generate.vaePrecision')}>+ <Field flex="1" hint="vaePrecision" label={t('widgets.generate.vaePrecision')}><HStack gap="1"><Selectaria-label={t('widgets.generate.vaePrecision')}@@ -186,7 +187,7 @@ export const GenerateAdvancedFields = ({{policy.clipSkipMax || policy.cfgRescaleVisible ? (<Stack gap="2" p="2">{policy.clipSkipMax ? (- <Field label={t('widgets.generate.clipSkip')}>+ <Field hint="clipSkip" label={t('widgets.generate.clipSkip')}><SliderNumberFieldariaLabel={t('widgets.generate.clipSkip')}defaultValue={modelDefaults?.clipSkip}@@ -200,7 +201,7 @@ export const GenerateAdvancedFields = ({</Field>) : null}{policy.cfgRescaleVisible ? (- <Field label={t('widgets.generate.cfgRescale')}>+ <Field hint="cfgRescale" label={t('widgets.generate.cfgRescale')}><SliderNumberFieldariaLabel={t('widgets.generate.cfgRescale')}defaultValue={modelDefaults?.cfgRescaleMultiplier}@@ -217,7 +218,7 @@ export const GenerateAdvancedFields = ({) : null}{policy.colorCompensationVisible ? (- <Field label={t('widgets.generate.colorCompensation')} p="2">+ <Field hint="colorCompensation" label={t('widgets.generate.colorCompensation')} p="2"><Switch.Rootchecked={settings.colorCompensation}size="sm"@@ -233,7 +234,7 @@ export const GenerateAdvancedFields = ({{policy.pidVisible ? (<HStack alignItems="flex-start" gap="2" p="2">- <Field flex="2" label={t('widgets.generate.pid')} helpText={pidHelpText}>+ <Field flex="2" hint="pidMode" label={t('widgets.generate.pid')} helpText={pidHelpText}><Selectaria-label={t('widgets.generate.pid')}collection={pidModeCollection}@@ -266,7 +267,7 @@ export const GenerateAdvancedFields = ({) : null}{policy.seamlessVisible ? (- <Field label={t('widgets.generate.seamlessTiling')} p="2">+ <Field hint="seamlessTiling" label={t('widgets.generate.seamlessTiling')} p="2"><HStack gap="4"><SeamlessSwitchchecked={settings.seamlessXAxis}diff --git a/invokeai/frontend/webv2/src/features/generation/ui/GenerateConceptsSection.tsx b/invokeai/frontend/webv2/src/features/generation/ui/GenerateConceptsSection.tsxindex 78926593b5..dfc0241d22 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateConceptsSection.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateConceptsSection.tsx@@ -109,6 +109,7 @@ export const GenerateConceptsSection = ({<GenerateCollapsibleSection label={t('widgets.generate.concepts')} defaultOpen badges={badges} sectionId="concepts"><Stack gap="2" p="2"><Field+ hint="concepts"label={t('widgets.generate.addConcept')}helpText={selectedModel ? undefined : t('widgets.generate.selectMainModelBeforeConcepts')}>diff --git a/invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx b/invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsxindex 179fadaad2..0f1dc158bf 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateDimensionFields.tsx@@ -243,7 +243,7 @@ export const GenerateDimensionFields = ({defaultOpensectionId="dimensions">- <Field label={t('widgets.generate.aspectRatio')} p="2">+ <Field hint="aspectRatio" label={t('widgets.generate.aspectRatio')} p="2"><HStack gap="1"><AspectRatioSelectfallbackRatio={dimensionRatio}@@ -276,6 +276,7 @@ export const GenerateDimensionFields = ({<HStack alignItems="flex-start" gap="2" p="2"><Stack w="full"><Field+ hint="width"label={t('widgets.generate.width')}helpText={t('widgets.generate.multipleOf', { value: dimensionGrid })}>@@ -312,6 +313,7 @@ export const GenerateDimensionFields = ({</NumberInput.Root></Field><Field+ hint="height"label={t('widgets.generate.height')}helpText={t('widgets.generate.multipleOf', { value: dimensionGrid })}>diff --git a/invokeai/frontend/webv2/src/features/generation/ui/GenerateModelFields.tsx b/invokeai/frontend/webv2/src/features/generation/ui/GenerateModelFields.tsxindex 71873f1518..92beb58a4f 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/GenerateModelFields.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/GenerateModelFields.tsx@@ -76,7 +76,7 @@ export const GenerateModelFields = ({return (<GenerateCollapsibleSection label={t('widgets.generate.model')} defaultOpen sectionId="model"><Stack gap="2" p="2">- <Field label={t('widgets.generate.model')}>+ <Field hint="model" label={t('widgets.generate.model')}><ModelSelectfilter={(model) => isGenerateModelConfig(model) && isGenerateModelSelectable(model)}isClearable={false}@@ -91,7 +91,7 @@ export const GenerateModelFields = ({}}/></Field>- <Field label={t('widgets.generate.steps')}>+ <Field hint="steps" label={t('widgets.generate.steps')}><SliderNumberFieldariaLabel={t('widgets.generate.steps')}defaultValue={modelDefaults?.steps}@@ -105,7 +105,7 @@ export const GenerateModelFields = ({onChange={(steps) => commitNumber('steps', steps)}/></Field>- <Field label={policy.ui.guidanceLabel}>+ <Field hint="guidance" label={policy.ui.guidanceLabel}><SliderNumberFieldariaLabel={policy.ui.guidanceLabel}defaultValue={modelDefaults?.cfgScale}@@ -119,7 +119,7 @@ export const GenerateModelFields = ({/></Field>{policy.ui.schedulerVisible ? (- <Field label={t('widgets.generate.scheduler')}>+ <Field hint="scheduler" label={t('widgets.generate.scheduler')}><HStack gap="1"><Comboboxaria-label={t('widgets.generate.scheduler')}@@ -139,7 +139,7 @@ export const GenerateModelFields = ({</Field>) : null}{policy.ui.seedVisible ? (- <Field label={t('common.seed')}>+ <Field hint="seed" label={t('common.seed')}><HStack gap="2"><NumberInput.Rootsize="xs"diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsxindex b2e469d33f..29d239e01c 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/NegativePromptField.tsx@@ -178,7 +178,12 @@ export const NegativePromptField = ({const exitViewMode = useCallback(() => onTemplateViewModeChange?.(false), [onTemplateViewModeChange]);return (- <Field label={t('widgets.generate.negativePrompt')} labelEnd={labelEnd} helpText={isEnabled ? helpText : undefined}>+ <Field+ hint="negativePrompt"+ label={t('widgets.generate.negativePrompt')}+ labelEnd={labelEnd}+ helpText={isEnabled ? helpText : undefined}+ >{isEnabled ? (<><PromptTextareadiff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptField.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptField.tsxindex 4be68063b3..c15cccce1d 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptField.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptField.tsx@@ -262,7 +262,7 @@ export const PositivePromptField = ({const exitViewMode = useCallback(() => onTemplateViewModeChange?.(false), [onTemplateViewModeChange]);return (- <Field label={t('common.prompt')} labelEnd={labelEnd}>+ <Field hint="positivePrompt" label={t('common.prompt')} labelEnd={labelEnd}><Box ref={setImageDropRef} position="relative"><PromptTextarea{...PROMPT_ATTENTION_TARGET_PROPS}diff --git a/invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCard.tsx b/invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCard.tsxindex 8029f339ec..e49e8f573f 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCard.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageCard.tsx@@ -260,7 +260,7 @@ const ReferenceModelSelector = ({return (<Stack gap="1">- <FieldHeader label={t('widgets.generate.referenceImageModel')} />+ <FieldHeader hint="referenceImage" label={t('widgets.generate.referenceImageModel')} /><HStack gap="2"><ModelSelectdisabled={disabled}diff --git a/invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageControls.tsx b/invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageControls.tsxindex c2083850b4..affbd6da35 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageControls.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/reference-images/ReferenceImageControls.tsx@@ -5,6 +5,7 @@ import type {GenerateReferenceImageConfig,IPAdapterMethod,} from '@features/generation/core/types';+import type { FeatureHintId } from '@platform/ui/hints';import type { KeyboardEvent, ReactNode } from 'react';import {@@ -18,6 +19,7 @@ import {Text,} from '@chakra-ui/react';import { Field, Select, Slider } from '@platform/ui';+import { FeatureHint } from '@platform/ui/hints';import { ChevronRightIcon } from 'lucide-react';import { useCallback, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -89,14 +91,28 @@ const ADVANCED_TRIGGER_HOVER_STYLES = { color: 'fg' };const COLLAPSIBLE_INDICATOR_OPEN_STYLES = { transform: 'rotate(90deg)' };/** Tiny muted label row above a control, with optional right-aligned content. */-export const FieldHeader = ({ children, label }: { children?: ReactNode; label: string }) => (- <HStack justify="space-between" minH="4">+export const FieldHeader = ({+ children,+ hint,+ label,+}: {+ children?: ReactNode;+ hint?: FeatureHintId;+ label: string;+}) => {+ const labelText = (<Text color="fg.muted" fontSize="2xs" fontWeight="medium">{label}</Text>- {children}- </HStack>-);+ );++ return (+ <HStack justify="space-between" minH="4">+ {hint ? <FeatureHint hint={hint}>{labelText}</FeatureHint> : labelText}+ {children}+ </HStack>+ );+};/*** Controls for `ip_adapter` reference image configs. `children` renders inside@@ -260,7 +276,14 @@ export const IPAdapterControls = ({</SegmentGroup.Root></Stack>- <Field align="center" disabled={disabled} gap="3" label={t('widgets.generate.weight')} orientation="horizontal">+ <Field+ align="center"+ disabled={disabled}+ gap="3"+ hint="referenceImageWeight"+ label={t('widgets.generate.weight')}+ orientation="horizontal"+ ><Flex align="center" gap="3"><Slideraria-label={weightAriaLabel}@@ -435,7 +458,7 @@ export const FluxReduxControls = <T extends { imageInfluence: FluxReduxImageInfl);return (- <Field disabled={disabled} label={t('widgets.generate.imageInfluence')}>+ <Field disabled={disabled} hint="imageInfluence" label={t('widgets.generate.imageInfluence')}><Selectcollection={FLUX_REDUX_IMAGE_INFLUENCE_COLLECTION}deselectable={false}diff --git a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsxindex 0dd5443ec8..1d7acb65aa 100644--- a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx+++ b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx@@ -3,6 +3,7 @@ import type { GenerateLora, MainModelConfig, PromptHistoryItem } from '@featuresimport type { ProjectPromptDraft, ProjectPromptDraftPatch } from '@features/generation/settings';import type { ModelConfig } from '@features/models';import type { UpscaleWidgetValues } from '@features/upscale/core/types';+import type { FeatureHintId } from '@platform/ui/hints';import type { ChangeEvent } from 'react';import {@@ -265,6 +266,7 @@ const NumericSliderField = ({error,formatValue,helpText,+ hint,label,marks,numberMax,@@ -278,6 +280,7 @@ const NumericSliderField = ({error?: string;formatValue?: (value: number) => string;helpText?: string;+ hint?: FeatureHintId;label: string;marks?: number[];numberMax: number;@@ -288,7 +291,7 @@ const NumericSliderField = ({step: number;value: number;}) => (- <Field error={error} helpText={helpText} label={label}>+ <Field error={error} helpText={helpText} hint={hint} label={label}><HStack align="center" gap="3"><Slideraria-label={[label]}@@ -640,6 +643,7 @@ export const UpscaleWidgetView = () => {<Fielderror={values.upscaleModel ? undefined : t('widgets.upscale.spandrelModelRequired')}helpText={values.upscaleModel ? t('widgets.upscale.spandrelModelHelp') : undefined}+ hint="upscaleModel"label={t('widgets.upscale.spandrelModel')}><ModelSelect@@ -655,6 +659,7 @@ export const UpscaleWidgetView = () => {error={errors.scale}formatValue={(scale) => `${scale}×`}helpText={t('widgets.upscale.scaleHelp')}+ hint="upscaleScale"label={t('widgets.upscale.scale')}marks={[1, 2, 4, 8, 16]}numberMax={UPSCALE_SCALE_MAX}@@ -691,6 +696,7 @@ export const UpscaleWidgetView = () => {<NumericSliderFielderror={errors.creativity}helpText={t('widgets.upscale.creativityHelp')}+ hint="creativity"label={t('widgets.upscale.creativity')}marks={[UPSCALE_CREATIVITY_MIN, 0, UPSCALE_CREATIVITY_MAX]}numberMax={UPSCALE_CREATIVITY_MAX}@@ -702,6 +708,7 @@ export const UpscaleWidgetView = () => {<NumericSliderFielderror={errors.structure}helpText={t('widgets.upscale.structureHelp')}+ hint="structure"label={t('widgets.upscale.structure')}marks={[UPSCALE_STRUCTURE_MIN, 0, UPSCALE_STRUCTURE_MAX]}numberMax={UPSCALE_STRUCTURE_MAX}@@ -728,6 +735,7 @@ export const UpscaleWidgetView = () => {<Stack gap="3" p="2"><Fielderror={values.model ? undefined : t('widgets.upscale.mainModelRequired')}+ hint="model"label={t('widgets.upscale.mainModel')}><ModelSelect@@ -741,7 +749,7 @@ export const UpscaleWidgetView = () => {/></Field><SimpleGrid columns={{ base: 2, md: 3 }} gap="2">- <Field error={errors.steps} label={t('widgets.upscale.steps')}>+ <Field error={errors.steps} hint="steps" label={t('widgets.upscale.steps')}><NumberInput.Rootmax={1000}min={1}@@ -753,7 +761,7 @@ export const UpscaleWidgetView = () => {<NumberInput.Input fontVariantNumeric="tabular-nums" /></NumberInput.Root></Field>- <Field error={errors.cfgScale} label={t('widgets.upscale.cfgScale')}>+ <Field error={errors.cfgScale} hint="cfgScale" label={t('widgets.upscale.cfgScale')}><NumberInput.Rootmax={100}min={0}@@ -768,7 +776,7 @@ export const UpscaleWidgetView = () => {<NumberInput.Input fontVariantNumeric="tabular-nums" /></NumberInput.Root></Field>- <Field label={t('widgets.upscale.batchCount')}>+ <Field hint="batchCount" label={t('widgets.upscale.batchCount')}><NumberInput.Rootmin={1}size="xs"@@ -782,7 +790,7 @@ export const UpscaleWidgetView = () => {</NumberInput.Root></Field></SimpleGrid>- <Field label={t('widgets.upscale.scheduler')}>+ <Field hint="scheduler" label={t('widgets.upscale.scheduler')}><Comboboxaria-label={t('widgets.upscale.scheduler')}options={SCHEDULER_OPTIONS}@@ -791,7 +799,11 @@ export const UpscaleWidgetView = () => {onValueChange={(scheduler) => patch({ scheduler })}/></Field>- <Field error={values.shouldRandomizeSeed ? undefined : errors.seed} label={t('widgets.upscale.seed')}>+ <Field+ error={values.shouldRandomizeSeed ? undefined : errors.seed}+ hint="seed"+ label={t('widgets.upscale.seed')}+ ><HStack gap="2"><NumberInput.Rootdisabled={values.shouldRandomizeSeed}@@ -828,7 +840,7 @@ export const UpscaleWidgetView = () => {</Switch.Root></HStack></Field>- <Field label={t('widgets.upscale.addLora')}>+ <Field hint="concepts" label={t('widgets.upscale.addLora')}><ModelSelectexcludeKeys={selectedLoraKeys}filter={(model) =>@@ -890,6 +902,7 @@ export const UpscaleWidgetView = () => {<Fielderror={values.tileControlnetModel ? undefined : t('widgets.upscale.tileControlNetRequired')}helpText={values.tileControlnetModel ? t('widgets.upscale.tileControlNetHelp') : undefined}+ hint="tileControlNet"label={t('widgets.upscale.tileControlNet')}><ModelSelect@@ -907,6 +920,7 @@ export const UpscaleWidgetView = () => {<NumericSliderFielderror={errors.tileSize}helpText={t('widgets.upscale.tileSizeHelp')}+ hint="tileSize"label={t('widgets.upscale.tileSize')}marks={[UPSCALE_TILE_SIZE_MIN, 1024, UPSCALE_TILE_SIZE_MAX]}numberMax={UPSCALE_TILE_SIZE_MAX}@@ -918,6 +932,7 @@ export const UpscaleWidgetView = () => {<NumericSliderFielderror={errors.tileOverlap}helpText={t('widgets.upscale.tileOverlapHelp')}+ hint="tileOverlap"label={t('widgets.upscale.tileOverlap')}marks={[UPSCALE_TILE_OVERLAP_MIN, 128, 256, UPSCALE_TILE_OVERLAP_MAX]}numberMax={UPSCALE_TILE_OVERLAP_MAX}@@ -927,7 +942,11 @@ export const UpscaleWidgetView = () => {onChange={(tileOverlap) => patch({ tileOverlap })}/><SimpleGrid columns={{ base: 1, md: 2 }} gap="2">- <Field label={t('widgets.upscale.vae')} helpText={values.vae ? undefined : t('widgets.upscale.bundledVae')}>+ <Field+ hint="vae"+ label={t('widgets.upscale.vae')}+ helpText={values.vae ? undefined : t('widgets.upscale.bundledVae')}+ ><ModelSelectfilter={(model) => Boolean(values.model && model.base === values.model.base)}isClearable@@ -938,7 +957,7 @@ export const UpscaleWidgetView = () => {onChange={(model) => patch({ vae: isVaeModelConfig(model) ? model : null })}/></Field>- <Field label={t('widgets.upscale.vaePrecision')}>+ <Field hint="vaePrecision" label={t('widgets.upscale.vaePrecision')}><Selectaria-label={t('widgets.upscale.vaePrecision')}collection={VAE_PRECISION_COLLECTION}@@ -955,7 +974,7 @@ export const UpscaleWidgetView = () => {</Field></SimpleGrid>{values.model?.base === 'sd-1' ? (- <Field label={t('widgets.upscale.clipSkip')}>+ <Field hint="clipSkip" label={t('widgets.upscale.clipSkip')}><NumberInput.Rootmax={12}min={0}diff --git a/invokeai/frontend/webv2/src/platform/ui/Field.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/Field.browser.test.tsxnew file mode 100644index 0000000000..b29f0c86b6--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/Field.browser.test.tsx@@ -0,0 +1,91 @@+import { ChakraProvider, Input } from '@chakra-ui/react';+import { system } from '@theme/system';+import { createInstance } from 'i18next';+import { act } from 'react';+import { createRoot, type Root } from 'react-dom/client';+import { I18nextProvider, initReactI18next } from 'react-i18next';+import { afterEach, describe, expect, it } from 'vitest';++import { Field } from './Field';+import { FeatureHintsProvider } from './hints';++const i18n = createInstance();+void i18n.use(initReactI18next).init({+ fallbackLng: 'en',+ initAsync: false,+ lng: 'en',+ resources: { en: { translation: { hints: { steps: { heading: 'Steps', paragraphs: ['How many steps.'] } } } } },+});++const HINTS_ENABLED = { enabled: true, onDisable: null };++let host: HTMLDivElement | null = null;+let root: Root | null = null;+(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;++afterEach(async () => {+ await act(() => root?.unmount());+ host?.remove();+ host = null;+ root = null;+});++const render = async (hinted: boolean) => {+ host = document.createElement('div');+ document.body.append(host);+ root = createRoot(host);++ await act(() => {+ root?.render(+ <ChakraProvider value={system}>+ <I18nextProvider i18n={i18n}>+ <FeatureHintsProvider adapter={HINTS_ENABLED}>+ <Field hint={hinted ? 'steps' : undefined} id="steps-field" label="Steps">+ <Input />+ </Field>+ </FeatureHintsProvider>+ </I18nextProvider>+ </ChakraProvider>+ );+ });++ return host;+};++describe('Field with a hint', () => {+ /**+ * The hover-card trigger stamps its own `id` on whatever element it wraps, so+ * making the `<label>` itself the trigger replaced the Field-derived id that+ * controls reference through `aria-labelledby` — axe reported every hinted+ * Select as having no accessible name. The trigger must sit *inside* the label.+ */+ it('keeps the Field-derived label id when a hint is attached', async () => {+ const hosted = await render(true);+ const label = hosted.querySelector('label');++ expect(label?.id).toBe('steps-field-label');+ expect(hosted.querySelector('[data-part="trigger"]')?.id).not.toBe('steps-field-label');+ });++ it('renders the same label id and text with and without a hint', async () => {+ const hinted = await render(true);+ const hintedLabel = hinted.querySelector('label');++ expect(hintedLabel?.textContent).toBe('Steps');+ await act(() => root?.unmount());+ host?.remove();++ const plain = await render(false);+ const plainLabel = plain.querySelector('label');++ expect(plainLabel?.id).toBe(hintedLabel?.id);+ expect(plainLabel?.textContent).toBe('Steps');+ expect(plain.querySelector('[data-part="trigger"]')).toBeNull();+ });++ it('makes the label text the hover target', async () => {+ const hosted = await render(true);++ expect(hosted.querySelector('label [data-part="trigger"]')?.textContent).toBe('Steps');+ });+});diff --git a/invokeai/frontend/webv2/src/platform/ui/Field.tsx b/invokeai/frontend/webv2/src/platform/ui/Field.tsxindex 7e4e157eb0..e9c25ea13f 100644--- a/invokeai/frontend/webv2/src/platform/ui/Field.tsx+++ b/invokeai/frontend/webv2/src/platform/ui/Field.tsx@@ -1,6 +1,8 @@+import type { FeatureHintId } from '@platform/ui/hints';import type { ReactNode } from 'react';-import { Field as ChakraField, HStack, Stack, Text, useRecipe, type StackProps } from '@chakra-ui/react';+import { chakra, Field as ChakraField, HStack, Stack, Text, useRecipe, type StackProps } from '@chakra-ui/react';+import { FeatureHint } from '@platform/ui/hints';import { fieldLabelRecipe } from '@theme/recipes';import { useMemo } from 'react';@@ -31,6 +33,8 @@ export interface FieldProps extends Omit<StackProps, 'disabled' | 'id' | 'readOn/** Validation error, shown in place of `helpText`; also marks the field invalid by default. */error?: string | null;helpText?: string;+ /** Opens an informational hint card when the label is hovered. */+ hint?: FeatureHintId;children: ReactNode;}@@ -40,6 +44,7 @@ export const Field = ({disabled,error,helpText,+ hint,id,invalid,label,@@ -63,7 +68,23 @@ export const Field = ({: undefined,[id]);- const labelContent = <ChakraField.Label css={recipe()}>{label}</ChakraField.Label>;+ // The hint wraps the label's *text*, never the `ChakraField.Label` itself:+ // the hover-card trigger stamps its own `id` on whatever element it is given,+ // which would clobber the id that every control's `aria-labelledby` points at+ // and leave the control with no accessible name. A conditional render, not a+ // conditional hook — `FeatureHint` owns the context read and returns its child+ // untouched when hints are off.+ const labelContent = (+ <ChakraField.Label css={recipe()}>+ {hint ? (+ <FeatureHint hint={hint}>+ <chakra.span>{label}</chakra.span>+ </FeatureHint>+ ) : (+ label+ )}+ </ChakraField.Label>+ );const message = error ? (<ChakraField.ErrorText color="fg.error" fontSize="2xs" role="alert">{error}diff --git a/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx b/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsxindex d9c0231cf3..681f90775f 100644--- a/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx+++ b/invokeai/frontend/webv2/src/workbench/settings/SettingsDialog.tsx@@ -408,7 +408,6 @@ const BehaviorSection = () => {/><SettingTogglechecked={enableInformationalPopovers}- comingSoondescription="Show educational popovers on controls that have extra guidance."label="Enable informational popovers"onChange={updateEnableInformationalPopovers}