Skip to content

Commit

Permalink
Use fieldset id instead of the fieldset title in Form when render…
Browse files Browse the repository at this point in the history
…ing the Field component (#5921)

Co-authored-by: Steve Piercy <[email protected]>
  • Loading branch information
sneridagh and stevepiercy authored Mar 26, 2024
1 parent 8001022 commit ca64494
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/source/upgrade-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +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 `id` of the current fieldset

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)=

## Upgrading to Volto 17.x.x
Expand Down
1 change: 1 addition & 0 deletions packages/types/news/5921.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix experimental settings and new button type @sneridagh
7 changes: 6 additions & 1 deletion packages/types/src/config/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ export type ComponentsConfig = Record<
{ component: React.ComponentType }
>;

export type ExperimentalConfig = Record<string, unknown>;
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;
Expand Down
1 change: 1 addition & 0 deletions packages/volto/news/5921.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `id` instead of `title` for the fieldset's generated value when rendering a `Field` component in a form. @sneridagh
2 changes: 1 addition & 1 deletion packages/volto/src/components/manage/Form/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit ca64494

Please sign in to comment.