fix: use correct WordPress Modal component props
Fix modal that was persisting by using correct @wordpress/components Modal API: - Use 'open' instead of 'isOpen' prop - Use 'onRequestClose' instead of 'onClose' - Add 'isDismissible' to allow closing with ESC/outside click - Add 'focusOnMount' for accessibility - Add deprecation warning props for TextControl (__next40pxDefaultSize, __nextHasNoMarginBottom) Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -535,10 +535,17 @@ export default function DataTable({
|
||||
{actions.addNew && (
|
||||
<Modal
|
||||
title={actions.addNew.label || __('Add New', 'formipay')}
|
||||
isOpen={isAddModalOpen}
|
||||
onClose={() => setIsAddModalOpen(false)}
|
||||
open={isAddModalOpen}
|
||||
onRequestClose={() => {
|
||||
setIsAddModalOpen(false);
|
||||
setNewItemTitle('');
|
||||
}}
|
||||
isDismissible
|
||||
focusOnMount="firstContentElement"
|
||||
>
|
||||
<TextControl
|
||||
__next40pxDefaultSize
|
||||
__nextHasNoMarginBottom
|
||||
label={__('Title', 'formipay')}
|
||||
value={newItemTitle}
|
||||
onChange={setNewItemTitle}
|
||||
@@ -547,7 +554,10 @@ export default function DataTable({
|
||||
<div className="formipay-modal-actions">
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => setIsAddModalOpen(false)}
|
||||
onClick={() => {
|
||||
setIsAddModalOpen(false);
|
||||
setNewItemTitle('');
|
||||
}}
|
||||
>
|
||||
{__('Cancel', 'formipay')}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user