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

DataForm: make it work nicely with bulk editing #65685

Open
oandregal opened this issue Sep 26, 2024 · 5 comments
Open

DataForm: make it work nicely with bulk editing #65685

oandregal opened this issue Sep 26, 2024 · 5 comments
Assignees
Labels
[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Type] Enhancement A suggestion for improvement.

Comments

@oandregal
Copy link
Member

oandregal commented Sep 26, 2024

Part of #59745

When selecting multiple items and open the QuickEdit, we need to make sure to provide a good experience.

Questions to resolve:

  • Header: what to do with Title & Actions.
  • Fields:
    • to display "Mixed" when the values differ
    • what do we do with fields that don't support "bulk editing"? do we hide them or make them uneditable?
@oandregal oandregal added [Type] Enhancement A suggestion for improvement. [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond labels Sep 26, 2024
@oandregal oandregal mentioned this issue Sep 26, 2024
20 tasks
@oandregal oandregal changed the title DataForm: bulk editing DataForm: make it work nicely with bulk editing Sep 26, 2024
@oandregal
Copy link
Member Author

oandregal commented Sep 26, 2024

@jameskoster this would need some design feedback. Is this the target we should aim to? It means:

  • header:
    • always to be displayed
    • title: number of items selected
    • actions: what do we display here? only the ones that are available in bulk editing?
  • fields:
    • to display "Mixed" when values differ
    • what do we do with fields that don't support "bulk editing"? do we hide them or make them uneditable?

Bulk edit

@jameskoster
Copy link
Contributor

Yeah, the actions menu would include any actions that can be applied in bulk (e.g. Trash).

what do we do with fields that don't support "bulk editing"?

For now it probably makes sense to hide fields that cannot be bulk edited. For instance there's a lot of value in displaying Title: Mixed as a non-interactive element.

That said, it may get a bit more nuanced when we get to media... there can be value in displaying certain non-editable fields like file format / size / dimensions. If they disappeared on bulk selection the experience might be a bit... strange. Notice how Finder shows -- in the Dimensions field, we might do something similar:

Screenshot 2024-09-27 at 14 02 35

@gigitux gigitux self-assigned this Oct 24, 2024
@gigitux
Copy link
Contributor

gigitux commented Oct 25, 2024

@oandregal Do you think that this issue should be resolved on data views library level or on the consumer side? At least, for now, I more inclined to this latter approach.

In the case of the page view, I would update this code:

const fields = useMemo(
() =>
_fields?.map( ( field ) => {
if ( field.id === 'status' ) {
return {
...field,
elements: field.elements.filter(
( element ) => element.value !== 'trash'
),
};
}
return field;
} ),
[ _fields ]

to something like this:

	const fields = useMemo(
		() =>
			_fields?.map( ( field ) => {
				if ( field.id === 'status' ) {
					return {
						...field,
						elements: field.elements.filter(
							( element ) => element.value !== 'trash'
						),
					};
				}
// Add another condition we render `Mixed` only when values differ
				if ( ids.length > 1  ) {
					return {
						...field,
						render: ( { value, onChange } ) => <>Mixed</>,
					};
				}

				return field;
			} ),
		[ _fields, ids.length ]
	);

@oandregal
Copy link
Member Author

oandregal commented Oct 28, 2024

Do you think that this issue should be resolved on data views library level or on the consumer side? At least, for now, I more inclined to this latter approach.

There are two issues here:

  • header/(bulk) actions: this is consumer level. It has to do with the PostCardPanel component or use a different thing, etc.
  • for fields, it depends
    • some fields cannot be edited in bulk (slug), so for these, hiding them is ok
    • mostly any other field could work in bulk editing but they don't or work clumsily: your proposal sounds good to me

@gigitux
Copy link
Contributor

gigitux commented Oct 28, 2024

Sorry for not being clear, with this issue, I was mostly referring to the “field” preview issue.

Thanks for the feedback! I will start to work on this soon! 🙇

@gigitux gigitux removed their assignment Oct 31, 2024
@louwie17 louwie17 self-assigned this Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

4 participants