kirby icon indicating copy to clipboard operation
kirby copied to clipboard

[develop] new object field some console errors

Open afbora opened this issue 1 year ago • 11 comments

Sorry for overlooking the errors in the console before the PR merged.

Few issues

  1. When first click add and open the drawer

Uncaught TypeError: Cannot read properties of undefined (reading 'isOpen') Uncaught TypeError: Cannot read properties of undefined (reading 'open')

  1. When click tags field

Uncaught TypeError: Cannot read properties of undefined (reading 'focus')

Sample blueprint

fields:      
  person:
    label: Person One
    type: object
    fields:
      category:
        label: Category
        type: multiselect
        options:
          design: Design
          architecture: Architecture
          photography: Photography
          3d: 3D
          web: Web
      name:
        type: text
      pages:
        type: pages
      files:
        type: files
      tags:
        type: tags

afbora avatar Sep 21 '22 11:09 afbora

Cannot reproduce this.

distantnative avatar Sep 21 '22 11:09 distantnative

https://user-images.githubusercontent.com/3393422/191491705-c37dbd76-a657-40b3-85a0-87eca09dff25.mp4

afbora avatar Sep 21 '22 11:09 afbora

Looks like you aren't running npm run dev?

distantnative avatar Sep 21 '22 11:09 distantnative

Yes, I always run my tests with build.

afbora avatar Sep 21 '22 11:09 afbora

Cannot reproduce it with build either. Have you deleted the media folder before testing?

distantnative avatar Sep 21 '22 11:09 distantnative

Have you deleted the media folder before testing?

Always 🙂

afbora avatar Sep 21 '22 11:09 afbora

I've tested on Firefox and same..

afbora avatar Sep 21 '22 12:09 afbora

Hm, I wonder if this is a Windows vs. Mac problem. I cannot reproduce it either. So weird.

bastianallgeier avatar Sep 22 '22 07:09 bastianallgeier

I've tracked down and I've some clues.. I guess this is about click event.

  1. Triggered click event from object field: https://github.com/getkirby/kirby/blob/develop/panel/src/components/Forms/Field/ObjectField.vue#L19

  2. Multiselect field catches the click event and tries to open or close the ref: https://github.com/getkirby/kirby/blob/44158e8a5856384f35b07263240abc96db16ae7e/panel/src/components/Forms/Input/MultiselectInput.vue#L205-L212

afbora avatar Sep 22 '22 09:09 afbora

@bastianallgeier I have prepared a rough PR https://github.com/getkirby/kirby/pull/4685 for you that fixes the issue. It can give you an idea.

afbora avatar Sep 22 '22 09:09 afbora

@bastianallgeier @distantnative Now I've steps to reproduce. Critical step is refresh (hard) the page.

  1. Login panel
  2. Edit any page that have related sample fields in first comment https://github.com/getkirby/kirby/issues/4681#issue-1380754676
  3. Before click object, hard refresh the page
  4. Click to object field
  5. Check console error

afbora avatar Sep 22 '22 09:09 afbora

bastianallgeier avatar Sep 27 '22 10:09 bastianallgeier