From e79768c7ced1421e49e9effca54b47ff388229f1 Mon Sep 17 00:00:00 2001 From: Nathan Vasse Date: Fri, 2 Feb 2024 15:06:35 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(react)=20fix=20DatePicker=20submit?= =?UTF-8?q?=20button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the default type of button is "submit", when including a DatePicker inside a form, clicking on any of its button was triggering form submission. Fixes #245 --- .changeset/rude-monkeys-behave.md | 5 ++++ .../components/Forms/DatePicker/Calendar.tsx | 6 ++++ .../Forms/DatePicker/CalendarCell.tsx | 1 + .../Forms/DatePicker/DatePickerAux.tsx | 30 +++++++++++-------- 4 files changed, 29 insertions(+), 13 deletions(-) create mode 100644 .changeset/rude-monkeys-behave.md diff --git a/.changeset/rude-monkeys-behave.md b/.changeset/rude-monkeys-behave.md new file mode 100644 index 000000000..38d3286d1 --- /dev/null +++ b/.changeset/rude-monkeys-behave.md @@ -0,0 +1,5 @@ +--- +"@openfun/cunningham-react": patch +--- + +fix DatePicker submit button diff --git a/packages/react/src/components/Forms/DatePicker/Calendar.tsx b/packages/react/src/components/Forms/DatePicker/Calendar.tsx index b725f4292..4157aea7b 100644 --- a/packages/react/src/components/Forms/DatePicker/Calendar.tsx +++ b/packages/react/src/components/Forms/DatePicker/Calendar.tsx @@ -233,6 +233,7 @@ const CalendarAux = forwardRef( }} disabled={isPrevButtonDisabled} onClick={() => state.focusPreviousSection()} + type="button" />