Skip to content
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

Use fieldset id instead of the fieldset title in Form when rendering the Field component #5921

Merged
merged 8 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

A bug where a fieldset's `title` contains spaces would cause the generated `id` to be invalid.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
This has been fixed by passing down the fieldset `id` instead of the `title`.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
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.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved

(volto-upgrade-guide-17.x.x)=

## Upgrading to Volto 17.x.x
Expand Down
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 fieldset id instead of the title in Form when rendering the Field component @sneridagh
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
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
Loading