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

Data Views - Slug Field Control: Implement validation #66397

Open
gigitux opened this issue Oct 24, 2024 · 0 comments
Open

Data Views - Slug Field Control: Implement validation #66397

gigitux opened this issue Oct 24, 2024 · 0 comments
Labels
[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Package] DataViews /packages/dataviews

Comments

@gigitux
Copy link
Contributor

gigitux commented Oct 24, 2024

The Slug Field Control currently lacks validation, allowing the save button to be clickable even when the input is empty:

image

This isn’t ideal because a page/post should always have a slug set. Currently, if the input is empty, the original slug is restored on the onBlur event, which is not the best UX.

Technical Investigation Required

There is an edge-case that I think that we should take care, but I will wait for your feedback before to proceed. When the input is empty, the save button is clickable:
It's ok to address this in a follow-up, but wanted to share some thoughts:

  • we already validation in fields (isValid)
  • it's already built-in in the types (if your field declares a type it doesn't have to have its own isValid)
  • there's an utility to validate all fields based on their isValid callback: isItemValid that we are already using in some scenarios >(reorder page modal)

Thinking about how to scope next steps, this is what I think we should do:

  • Connecting the existing isItemValid utility to the save button in the site editor.
  • Implement isValid in the slug field introduced here to check for non empty.

Note that when we introduce "slug" field type, that should be automatically created for the field — but that requires other things we don't have yet (being able to register new fields types).

Originally posted by @oandregal in #65196 (comment)

@gigitux gigitux added [Package] DataViews /packages/dataviews [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond labels Oct 24, 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 [Package] DataViews /packages/dataviews
Projects
None yet
Development

No branches or pull requests

1 participant