Auto-focus workflow title field when creating new workflow (#16765)

Closes #14135 



https://github.com/user-attachments/assets/4170c33d-4a2e-450a-98c0-20163d4b2382
This commit is contained in:
Abdul Rahman
2025-12-23 16:06:23 +05:30
committed by GitHub
parent 1dbb326fd6
commit 42ad4630ea
3 changed files with 78 additions and 4 deletions
@@ -101,10 +101,25 @@ export const useCreateNewIndexRecord = ({
});
}
} else {
navigate(AppPath.RecordShowPage, {
objectNameSingular: objectMetadataItem.nameSingular,
objectRecordId: recordId,
});
const labelIdentifierFieldMetadataItem =
getLabelIdentifierFieldMetadataItem(objectMetadataItem);
navigate(
AppPath.RecordShowPage,
{
objectNameSingular: objectMetadataItem.nameSingular,
objectRecordId: recordId,
},
undefined,
{
state: {
isNewRecord: true,
objectRecordId: recordId,
labelIdentifierFieldName:
labelIdentifierFieldMetadataItem?.name,
},
},
);
}
if (isDefined(recordIndexGroupFieldMetadataItem)) {
@@ -0,0 +1,43 @@
import { isTitleCellInEditModeComponentState } from '@/object-record/record-title-cell/states/isTitleCellInEditModeComponentState';
import { RecordTitleCellContainerType } from '@/object-record/record-title-cell/types/RecordTitleCellContainerType';
import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId';
import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';
import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';
import { useRecoilCallback } from 'recoil';
export const useOpenNewRecordTitleCell = () => {
const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack();
const openNewRecordTitleCell = useRecoilCallback(
({ set }) =>
({ recordId, fieldName }: { recordId: string; fieldName: string }) => {
const instanceId = getRecordFieldInputInstanceId({
recordId,
fieldName,
prefix: RecordTitleCellContainerType.PageHeader,
});
pushFocusItemToFocusStack({
focusId: instanceId,
component: {
type: FocusComponentType.OPENED_FIELD_INPUT,
instanceId,
},
globalHotkeysConfig: {
enableGlobalHotkeysConflictingWithKeyboard: false,
enableGlobalHotkeysWithModifiers: false,
},
});
set(
isTitleCellInEditModeComponentState.atomFamily({
instanceId,
}),
true,
);
},
[pushFocusItemToFocusStack],
);
return { openNewRecordTitleCell };
};