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

Clicking errors on top right corner of document fails to scroll/open error location if inside closed fieldset #1866

Closed
fvieira opened this issue May 1, 2020 · 2 comments
Labels

Comments

@fvieira
Copy link

fvieira commented May 1, 2020

Describe the bug

Errors in a document appear at the top right of the document editor, and can be clicked to go directly to the error's source, either by scrolling if the field is visible or by opening an object if the field is hidden inside one.
Unfortunatly when the field with the error is inside a collapsed fieldset, scrolling doesn't work, and opening the object only works if the fieldset has been uncollapsed at least once.

To Reproduce

Here are two screencasts showing the problem in both cases (field inside an object and otherwise), and the code used to create both.

Screencasts.zip

{
    name: 'product',
    title: 'Products',
    type: 'document',

    fieldsets: [
      {
        name: 'characteristics',
        title: 'Characteristics',
        options: {
          collapsible: true,
          collapsed: true,
        },
      },
    ],

    fields: [
      {
        name: 'a',
        title: 'a',
        type: 'text',
      },
      {
        name: 'b',
        title: 'b',
        type: 'text',
      },
      {
        name: 'c',
        title: 'c',
        type: 'text',
      },
      {
        name: 'd',
        title: 'd',
        type: 'text',
      },
      {
        name: 'type',
        title: 'Type',
        type: 'reference',
        to: {
          type: 'productType',
        },
        fieldset: 'characteristics',
        validation: Rule => Rule.required(),
      },
    ],
  },
{
    name: 'myObject',
    title: 'My Object',
    type: 'object',

    fields: [
      {
        name: 'a',
        type: 'string',
      },
      {
        name: 'type',
        type: 'reference',
        to: {
          type: 'productType',
        },

        validation: Rule => Rule.required(),
      },
    ],
  },
  {
    name: 'product',
    title: 'Products',
    type: 'document',

    fieldsets: [
      {
        name: 'characteristics',
        title: 'Characteristics',
        options: {
          collapsible: true,
          collapsed: true,
        },
      },
    ],

    fields: [
      {
        name: 'a',
        title: 'a',
        type: 'text',
      },
      {
        name: 'b',
        title: 'b',
        type: 'text',
      },
      {
        name: 'c',
        title: 'c',
        type: 'text',
      },
      {
        name: 'd',
        title: 'd',
        type: 'text',
      },
      {
        name: 'types',
        title: 'Types',
        type: 'array',
        of: [
          {
            type: 'myObject',
          },
        ],
        fieldset: 'characteristics',
      },
    ],
  },

Expected behavior

If the fieldset is collapsed:

  • I expect the fieldset to be uncollapsed and the autoscroll to happen
  • I expect the object where the errored field to be open

Which versions of Sanity are you using?

@sanity/cli 1.149.9 (up to date)
@sanity/base 1.149.10 (up to date)
@sanity/cli 1.149.9 (up to date)
@sanity/components 1.149.10 (up to date)
@sanity/core 1.149.12 (up to date)
@sanity/dashboard 1.149.10 (up to date)
@sanity/default-layout 1.149.10 (up to date)
@sanity/default-login 1.149.11 (up to date)
@sanity/desk-tool 1.149.10 (up to date)
@sanity/google-maps-input 1.149.7 (up to date)
@sanity/storybook 1.149.7 (up to date)
@sanity/vision 1.149.0 (up to date)

@vicmeow
Copy link
Contributor

vicmeow commented May 11, 2020

Thank you for submitting, we'll look into this 👍

@kmelve
Copy link
Member

kmelve commented Jan 12, 2023

Hi!

We are currently working on improving our workflows and follow-up on our open GitHub repository. In that work, we have decided to close most issues older than the release of Sanity Studio v3.

We value your feedback, so if this issue is still important to you and relevant for Sanity Studio v3, please search for relevant open issues. If you can’t find any, open a new one and link to relevant comments in this thread. For questions about how to do something, please post them in the slack community.

@kmelve kmelve closed this as completed Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants