From 317c0cf5843d8bab0493dc3956e40d00fe76388c Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Mon, 25 Mar 2024 17:51:13 +0100 Subject: [PATCH 1/8] Small types tweak and fix --- packages/types/src/config/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/types/src/config/index.d.ts b/packages/types/src/config/index.d.ts index 651ef24cf3..670b9636f9 100644 --- a/packages/types/src/config/index.d.ts +++ b/packages/types/src/config/index.d.ts @@ -17,8 +17,13 @@ export type ComponentsConfig = Record< { component: React.ComponentType } >; -export type ExperimentalConfig = Record; +export interface ExperimentalConfig { + addBlockButton: { + enabled: boolean; + }; +} +// This is a type because it's not supposed to be extendable export type ConfigData = { settings: SettingsConfig; blocks: BlocksConfig; From ed3088461fa5ad1403bc4ec74ece5de6adef7d57 Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Mon, 25 Mar 2024 18:00:34 +0100 Subject: [PATCH 2/8] Use fieldset id instead of the title in Form when rendering the Field component --- docs/source/upgrade-guide/index.md | 8 ++++++++ packages/volto/src/components/manage/Form/Form.jsx | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/source/upgrade-guide/index.md b/docs/source/upgrade-guide/index.md index 5b4b0c6313..1fc9811741 100644 --- a/docs/source/upgrade-guide/index.md +++ b/docs/source/upgrade-guide/index.md @@ -218,6 +218,14 @@ The `.stories.mdx` extension is no longer supported. Although it is technically possible to keep the old version running, the script `volto-update-deps` will try to update to Storybook 8 every time you run it. ``` +### Form component passes down the id of the current fieldset + +There was a bug that was provoking to have `id` attributes with spaces on it, if the a fieldset was longer than one word. +This was because the fieldset `title` was passed down. +The fieldset `id` is passed now instead of the `title`. +If you are relying on this for selecting fields by `id`, could be that tests could break. +If that's the case you should amend them to use the `id`. + (volto-upgrade-guide-17.x.x)= ## Upgrading to Volto 17.x.x diff --git a/packages/volto/src/components/manage/Form/Form.jsx b/packages/volto/src/components/manage/Form/Form.jsx index cdf7209408..08249c4fae 100644 --- a/packages/volto/src/components/manage/Form/Form.jsx +++ b/packages/volto/src/components/manage/Form/Form.jsx @@ -843,7 +843,7 @@ class Form extends Component { {...schema.properties[field]} id={field} formData={formData} - fieldSet={item.title.toLowerCase()} + fieldSet={item.id} focus={this.state.inFocus[field]} value={formData?.[field]} required={schema.required.indexOf(field) !== -1} From a376aa288faeaa8ecefbd4ac8e056d57344fb0a1 Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Mon, 25 Mar 2024 18:01:53 +0100 Subject: [PATCH 3/8] Changelog --- packages/volto/news/5921.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/volto/news/5921.bugfix diff --git a/packages/volto/news/5921.bugfix b/packages/volto/news/5921.bugfix new file mode 100644 index 0000000000..bc67bd0eca --- /dev/null +++ b/packages/volto/news/5921.bugfix @@ -0,0 +1 @@ +Use fieldset id instead of the title in Form when rendering the Field component @sneridagh From 56c96da81c14468007382c4d82ff45302178af2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Mon, 25 Mar 2024 21:58:14 +0100 Subject: [PATCH 4/8] Apply suggestions from code review Co-authored-by: Steve Piercy --- docs/source/upgrade-guide/index.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/source/upgrade-guide/index.md b/docs/source/upgrade-guide/index.md index 1fc9811741..7f80aaf571 100644 --- a/docs/source/upgrade-guide/index.md +++ b/docs/source/upgrade-guide/index.md @@ -218,13 +218,12 @@ The `.stories.mdx` extension is no longer supported. Although it is technically possible to keep the old version running, the script `volto-update-deps` will try to update to Storybook 8 every time you run it. ``` -### Form component passes down the id of the current fieldset +### Form component passes down `id` of the current fieldset There was a bug that was provoking to have `id` attributes with spaces on it, if the a fieldset was longer than one word. This was because the fieldset `title` was passed down. The fieldset `id` is passed now instead of the `title`. -If you are relying on this for selecting fields by `id`, could be that tests could break. -If that's the case you should amend them to use the `id`. +If you rely on the fieldset's `title` attribute for selecting fields, your tests could break, in which case you should amend them to use the fieldset's `id` instead. (volto-upgrade-guide-17.x.x)= From 006e74cd23575ff0eda7a68abf690bc95373fbd3 Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Mon, 25 Mar 2024 22:03:02 +0100 Subject: [PATCH 5/8] Completed and updated paragraph --- docs/source/upgrade-guide/index.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/source/upgrade-guide/index.md b/docs/source/upgrade-guide/index.md index 7f80aaf571..4808eb6a37 100644 --- a/docs/source/upgrade-guide/index.md +++ b/docs/source/upgrade-guide/index.md @@ -220,10 +220,9 @@ Although it is technically possible to keep the old version running, the script ### Form component passes down `id` of the current fieldset -There was a bug that was provoking to have `id` attributes with spaces on it, if the a fieldset was longer than one word. -This was because the fieldset `title` was passed down. -The fieldset `id` is passed now instead of the `title`. -If you rely on the fieldset's `title` attribute for selecting fields, your tests could break, in which case you should amend them to use the fieldset's `id` instead. +A bug where a fieldset's `title` contains spaces would cause the generated `id` to be invalid. +This has been fixed by passing down the fieldset `id` instead of the `title`. +If your tests rely on the old fieldset's generated `id` attribute for selecting fields, your tests could break, in which case you should amend them to use the updated fieldset's `id` instead. (volto-upgrade-guide-17.x.x)= From 09b9d7f57dfee5218275d1e0c0023a5b57a18483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Tue, 26 Mar 2024 08:50:50 +0100 Subject: [PATCH 6/8] Apply suggestions from code review Co-authored-by: Steve Piercy --- docs/source/upgrade-guide/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/upgrade-guide/index.md b/docs/source/upgrade-guide/index.md index 4808eb6a37..4d6001ebae 100644 --- a/docs/source/upgrade-guide/index.md +++ b/docs/source/upgrade-guide/index.md @@ -220,9 +220,9 @@ Although it is technically possible to keep the old version running, the script ### Form component passes down `id` of the current fieldset -A bug where a fieldset's `title` contains spaces would cause the generated `id` to be invalid. -This has been fixed by passing down the fieldset `id` instead of the `title`. -If your tests rely on the old fieldset's generated `id` attribute for selecting fields, your tests could break, in which case you should amend them to use the updated fieldset's `id` instead. +There was a bug where a fieldset's generated value would be not valid. +This has been fixed by passing down the `id` instead of the `title` to the fieldset's value. +If your tests rely on the old fieldset's generated value for selecting fields, your tests could break, in which case you should amend them to use the updated fieldset's value instead. (volto-upgrade-guide-17.x.x)= From b3b4da7b3ff483f10485bc2cdc9e9893a07eaf13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Tue, 26 Mar 2024 10:50:23 +0100 Subject: [PATCH 7/8] Update packages/volto/news/5921.bugfix Co-authored-by: Steve Piercy --- packages/volto/news/5921.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/volto/news/5921.bugfix b/packages/volto/news/5921.bugfix index bc67bd0eca..b19d2552ed 100644 --- a/packages/volto/news/5921.bugfix +++ b/packages/volto/news/5921.bugfix @@ -1 +1 @@ -Use fieldset id instead of the title in Form when rendering the Field component @sneridagh +Use `id` instead of `title` for the fieldset's generated value when rendering a `Field` component in a form. @sneridagh From 7cb2687d20aa3b0a78f66c29c669126d8065def3 Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Tue, 26 Mar 2024 10:58:27 +0100 Subject: [PATCH 8/8] Changelog --- packages/types/news/5921.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/types/news/5921.bugfix diff --git a/packages/types/news/5921.bugfix b/packages/types/news/5921.bugfix new file mode 100644 index 0000000000..f9a12123c8 --- /dev/null +++ b/packages/types/news/5921.bugfix @@ -0,0 +1 @@ +Fix experimental settings and new button type @sneridagh