Skip to content

Commit 67ec546

Browse files
committed
feat: add modalFocusOnMount property to all eligible actions
1 parent 1e79d9f commit 67ec546

File tree

11 files changed

+11
-0
lines changed

11 files changed

+11
-0
lines changed

packages/editor/src/components/post-actions/set-as-homepage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export const useSetAsHomepageAction = () => {
160160

161161
return true;
162162
},
163+
modalFocusOnMount: 'firstContentElement',
163164
RenderModal: SetAsHomepageModal,
164165
} ),
165166
[ pageForPosts, pageOnFront ]

packages/editor/src/components/post-actions/set-as-posts-page.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export const useSetAsPostsPageAction = () => {
157157

158158
return true;
159159
},
160+
modalFocusOnMount: 'firstContentElement',
160161
RenderModal: SetAsPostsPageModal,
161162
} ),
162163
[ pageForPosts, pageOnFront ]

packages/fields/src/actions/delete-post.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const deletePostAction: Action< Template | TemplatePart | Pattern > = {
4747
},
4848
supportsBulk: true,
4949
hideModalHeader: true,
50+
modalFocusOnMount: 'firstContentElement',
5051
RenderModal: ( { items, closeModal, onActionPerformed } ) => {
5152
const [ isBusy, setIsBusy ] = useState( false );
5253
const isResetting = items.every(

packages/fields/src/actions/duplicate-pattern.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const duplicatePattern: Action< Pattern > = {
2121
label: _x( 'Duplicate', 'action label' ),
2222
isEligible: ( item ) => item.type !== 'wp_template_part',
2323
modalHeader: _x( 'Duplicate pattern', 'action label' ),
24+
modalFocusOnMount: 'firstContentElement',
2425
RenderModal: ( { items, closeModal } ) => {
2526
const [ item ] = items;
2627
const duplicatedProps = useDuplicatePatternProps( {

packages/fields/src/actions/duplicate-post.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const duplicatePost: Action< BasePost > = {
3333
isEligible( { status } ) {
3434
return status !== 'trash';
3535
},
36+
modalFocusOnMount: 'firstContentElement',
3637
RenderModal: ( { items, closeModal, onActionPerformed } ) => {
3738
const [ item, setItem ] = useState< BasePost >( {
3839
...items[ 0 ],

packages/fields/src/actions/duplicate-template-part.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const duplicateTemplatePart: Action< TemplatePart > = {
2424
label: _x( 'Duplicate', 'action label' ),
2525
isEligible: ( item ) => item.type === 'wp_template_part',
2626
modalHeader: _x( 'Duplicate template part', 'action label' ),
27+
modalFocusOnMount: 'firstContentElement',
2728
RenderModal: ( { items, closeModal } ) => {
2829
const [ item ] = items;
2930
const blocks = useMemo( () => {

packages/fields/src/actions/permanently-delete-post.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const permanentlyDeletePost: Action< PostWithPermissions > = {
3535
return status === 'trash' && permissions?.delete;
3636
},
3737
hideModalHeader: true,
38+
modalFocusOnMount: 'firstContentElement',
3839
RenderModal: ( { items, closeModal, onActionPerformed } ) => {
3940
const [ isBusy, setIsBusy ] = useState( false );
4041
const { createSuccessNotice, createErrorNotice } =

packages/fields/src/actions/rename-post.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const { PATTERN_TYPES } = unlock( patternsPrivateApis );
3535
const renamePost: Action< PostWithPermissions > = {
3636
id: 'rename-post',
3737
label: __( 'Rename' ),
38+
modalFocusOnMount: 'firstContentElement',
3839
isEligible( post ) {
3940
if ( post.status === 'trash' ) {
4041
return false;

packages/fields/src/actions/reorder-page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ const reorderPage: Action< BasePost > = {
119119
isEligible( { status } ) {
120120
return status !== 'trash';
121121
},
122+
modalFocusOnMount: 'firstContentElement',
122123
RenderModal: ReorderModal,
123124
};
124125

packages/fields/src/actions/reset-post.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ const resetPostAction: Action< Template | TemplatePart > = {
189189
icon: backup,
190190
supportsBulk: true,
191191
hideModalHeader: true,
192+
modalFocusOnMount: 'firstContentElement',
192193
RenderModal: ( { items, closeModal, onActionPerformed } ) => {
193194
const [ isBusy, setIsBusy ] = useState( false );
194195

0 commit comments

Comments
 (0)