-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Modal Accessibility and copy paste. #33509
Conversation
WalkthroughWalkthroughThe recent updates focus on enhancing modal components with the addition of the Changes
Assessment against linked issues
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
function* pasteAnvilModalWidgets( | ||
allWidgets: CanvasWidgetsReduxState, | ||
modalWidgetsToPaste: CopiedWidgetData[], | ||
) { | ||
const lastDestinationInfo: PasteDestinationInfo = yield call( | ||
getDestinedParent, | ||
allWidgets, | ||
modalWidgetsToPaste, | ||
allWidgets[MAIN_CONTAINER_WIDGET_ID], | ||
); | ||
|
||
// paste into main canvas | ||
const res: PastePayload = yield call( | ||
pasteWidgetsIntoMainCanvas, | ||
allWidgets, | ||
modalWidgetsToPaste, | ||
lastDestinationInfo, | ||
{}, | ||
{}, | ||
); | ||
return res; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling to pasteAnvilModalWidgets
.
To ensure robustness, consider adding a try-catch block to handle potential errors during the paste operation.
+ try {
const lastDestinationInfo: PasteDestinationInfo = yield call(
getDestinedParent,
allWidgets,
modalWidgetsToPaste,
allWidgets[MAIN_CONTAINER_WIDGET_ID],
);
// paste into main canvas
const res: PastePayload = yield call(
pasteWidgetsIntoMainCanvas,
allWidgets,
modalWidgetsToPaste,
lastDestinationInfo,
{},
{},
);
return res;
+ } catch (error) {
+ // Handle error appropriately
+ console.error("Error pasting modal widgets:", error);
+ return null;
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
function* pasteAnvilModalWidgets( | |
allWidgets: CanvasWidgetsReduxState, | |
modalWidgetsToPaste: CopiedWidgetData[], | |
) { | |
const lastDestinationInfo: PasteDestinationInfo = yield call( | |
getDestinedParent, | |
allWidgets, | |
modalWidgetsToPaste, | |
allWidgets[MAIN_CONTAINER_WIDGET_ID], | |
); | |
// paste into main canvas | |
const res: PastePayload = yield call( | |
pasteWidgetsIntoMainCanvas, | |
allWidgets, | |
modalWidgetsToPaste, | |
lastDestinationInfo, | |
{}, | |
{}, | |
); | |
return res; | |
} | |
function* pasteAnvilModalWidgets( | |
allWidgets: CanvasWidgetsReduxState, | |
modalWidgetsToPaste: CopiedWidgetData[], | |
) { | |
try { | |
const lastDestinationInfo: PasteDestinationInfo = yield call( | |
getDestinedParent, | |
allWidgets, | |
modalWidgetsToPaste, | |
allWidgets[MAIN_CONTAINER_WIDGET_ID], | |
); | |
// paste into main canvas | |
const res: PastePayload = yield call( | |
pasteWidgetsIntoMainCanvas, | |
allWidgets, | |
modalWidgetsToPaste, | |
lastDestinationInfo, | |
{}, | |
{}, | |
); | |
return res; | |
} catch (error) { | |
// Handle error appropriately | |
console.error("Error pasting modal widgets:", error); | |
return null; | |
} | |
} |
if (modalWidgets.length > 0) { | ||
// paste into main canvas | ||
const res: PastePayload = yield call( | ||
pasteAnvilModalWidgets, | ||
allWidgets, | ||
modalWidgets, | ||
); | ||
allWidgets = res.widgets; | ||
widgetIdMap = { ...widgetIdMap, ...res.widgetIdMap }; | ||
reverseWidgetIdMap = { ...reverseWidgetIdMap, ...res.reverseWidgetIdMap }; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling to the modal widget paste operation.
To ensure robustness, consider adding a try-catch block to handle potential errors during the modal widget paste operation.
+ try {
if (modalWidgets.length > 0) {
// paste into main canvas
const res: PastePayload = yield call(
pasteAnvilModalWidgets,
allWidgets,
modalWidgets,
);
allWidgets = res.widgets;
widgetIdMap = { ...widgetIdMap, ...res.widgetIdMap };
reverseWidgetIdMap = { ...reverseWidgetIdMap, ...res.reverseWidgetIdMap };
}
+ } catch (error) {
+ // Handle error appropriately
+ console.error("Error pasting modal widgets:", error);
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
if (modalWidgets.length > 0) { | |
// paste into main canvas | |
const res: PastePayload = yield call( | |
pasteAnvilModalWidgets, | |
allWidgets, | |
modalWidgets, | |
); | |
allWidgets = res.widgets; | |
widgetIdMap = { ...widgetIdMap, ...res.widgetIdMap }; | |
reverseWidgetIdMap = { ...reverseWidgetIdMap, ...res.reverseWidgetIdMap }; | |
} | |
try { | |
if (modalWidgets.length > 0) { | |
// paste into main canvas | |
const res: PastePayload = yield call( | |
pasteAnvilModalWidgets, | |
allWidgets, | |
modalWidgets, | |
); | |
allWidgets = res.widgets; | |
widgetIdMap = { ...widgetIdMap, ...res.widgetIdMap }; | |
reverseWidgetIdMap = { ...reverseWidgetIdMap, ...res.reverseWidgetIdMap }; | |
} | |
} catch (error) { | |
// Handle error appropriately | |
console.error("Error pasting modal widgets:", error); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is already a try catch for the scope of pasteWidgetSagas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon reviewing the pasteWidgetSagas
function, I can confirm that there is indeed a try-catch block encompassing the entire function. This means that any errors occurring during the modal widget paste operation will already be caught and handled by this existing block.
Therefore, no additional try-catch block is necessary for the modal widget paste operation.
@marks0351, you are correct. The existing try-catch block in the pasteWidgetSagas
function already handles errors for the entire scope, including the modal widget paste operation. No further changes are needed for error handling in this context. Thank you for pointing that out!
@@ -6,7 +6,12 @@ import { Button } from "../../Button"; | |||
import type { ModalFooterProps } from "./types"; | |||
|
|||
export const ModalFooter = (props: ModalFooterProps) => { | |||
const { closeText = "Close", onSubmit, submitText = "Submit" } = props; | |||
const { | |||
allowInteraction = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allowInteraction = true, | |
excludeFromTabOrder = true, |
I think having one name for things that do the same thing is a good idea.
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9110388245. |
Deploy-Preview-URL: https://ce-33509.dp.appsmith.com |
…o modal_deal_breakers
Description
In this Pr we are tackling a few issues.
Fixes #33382
Fixes #32923
or
Fixes
Issue URL
Warning
If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.
Automation
/ok-to-test tags="@tag.All"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9125695828
Commit: 05d011b
Cypress dashboard url: Click here!
Communication
Should the DevRel and Marketing teams inform users about this change?