From bc528655484d3b10a02e4e130deaf55c48519260 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Tue, 25 Mar 2025 10:18:20 +0530 Subject: [PATCH] chore: fix the WDS button widget click bug (#39874) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /ok-to-test tags="@tag.Anvil" The WDS Button widget was firing onClick twice. This was because we were sending onClick + onPress to the widget. And it was firing both. We don't need onClick prop. ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Improved button click event handling for better integration with verification features. - Added styling changes to enhance text rendering within code blocks in markdown content. > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 5343c7e3c9d721a2d4b0d0282ecff514855823ab > Cypress dashboard. > Tags: `@tag.Anvil` > Spec: >
Mon, 24 Mar 2025 14:14:21 UTC --- .../widgets/src/components/Markdown/src/styles.module.css | 1 + .../src/widgets/wds/WDSButtonWidget/component/index.tsx | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/client/packages/design-system/widgets/src/components/Markdown/src/styles.module.css b/app/client/packages/design-system/widgets/src/components/Markdown/src/styles.module.css index 6d83b09410..ec054452d8 100644 --- a/app/client/packages/design-system/widgets/src/components/Markdown/src/styles.module.css +++ b/app/client/packages/design-system/widgets/src/components/Markdown/src/styles.module.css @@ -108,6 +108,7 @@ pre { margin-top: var(--inner-spacing-4); margin-bottom: var(--inner-spacing-4); + font-family: unset; } blockquote { diff --git a/app/client/src/widgets/wds/WDSButtonWidget/component/index.tsx b/app/client/src/widgets/wds/WDSButtonWidget/component/index.tsx index 5be6c75187..7af4f7556c 100644 --- a/app/client/src/widgets/wds/WDSButtonWidget/component/index.tsx +++ b/app/client/src/widgets/wds/WDSButtonWidget/component/index.tsx @@ -17,9 +17,13 @@ export interface ButtonComponentProps extends ButtonProps { } function ButtonComponent(props: ButtonComponentProps & UseRecaptchaProps) { - const { icon, text, tooltip, ...rest } = props; + const { icon, onClick: onClickProp, text, tooltip, ...rest } = props; const { isFormValid, onReset } = useWDSZoneWidgetContext(); - const { onClick, recpatcha } = useRecaptcha({ ...props, onReset }); + const { onClick, recpatcha } = useRecaptcha({ + ...props, + onClick: onClickProp, + onReset, + }); const isDisabled = props.isDisabled || (props.disableOnInvalidForm && isFormValid === false);