getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.27k stars 167 forks source link

Autofocus doesn't work for blocks #3676

Closed MaluNoPeleke closed 3 years ago

MaluNoPeleke commented 3 years ago

Describe the bug
The autofocus property doesn't work with blocks.

To Reproduce
Add a blocks field like this to a blueprint:

          text: 
            type: blocks
            label: Artikel
            autofocus: true
            default:
              - type: text

Expected behavior
If this is the only autofocus: true field on a blueprint I expect that I could directly start writing in the text block.

Kirby Version
3.6.0-alpha-4

Console output

Desktop (please complete the following information):

Additional context
This is the complete blueprint:

title: Article
num: '{{ page.date.toDate("%Y%m%d") }}'
icon: book

tabs:
  article:
    label: Inhalt
    icon: text
    status:
      draft:
        label: Entwurf
        text: Der Artikel befindet sich noch im Entwurfsmodus. Er kann nur von Redakteuren mit Panel-Zugang eingesehen werden.
      unlisted:
        label: Zur Freigabe
        text: Der Artikel ist online und kann mit der direkten URL besucht werden. Das Team muss noch das endgültige Go geben, um ihn zu veröffentlichen.
      listed:
        label: Veröffentlicht
        text: Der Artikel ist online und im Blog aufgeführt

    columns:
      main:
        width: 2/3
        fields:
          author:
            type: users
            label: Autor
            width: 1/2
            translate: false
          modified:
            type: info 
            label: Letzte Änderung
            theme: none
            text: "{{ page.modified('%d.%m.%Y %H:%M') }}"
            width: 1/2
            align: right
          intro: 
            type: text
            label: Intro
          text: 
            type: blocks
            label: Artikel
            autofocus: true
            default:
              - type: text

      sidebar:
        width: 1/3
        sections:
          meta:
            type: fields
            fields:
              date:
                type: date
                time: true
                default: now
                label: Datum
                display: DD.MM.YYYY
                translate: false
              autopublish:
                label: Autopublish
                type: date
                time: true
                default: now
                display: DD.MM.YYYY
                translate: false
              cover:
                label: Artikelbild
                type: files
                max: 1
                multiple: false
                layout: cards
                translate: false
                query: page.images
                uploads: image
                info: "{{ file.dimensions }}"
                image:
                  cover: true
                  ratio: 16/9
              featured:
                type: toggle
                label: Hervorheben
                translate: false
              tags:
                type: tags
                options: query
                query: site.index.pluck("tags", ",", true)
              taglist:
                type: info
                theme: none
                text: "{{ page.taglist }}"
              usefullinks:
                type: info
                label: Hilfreiche Links
                text: |
                      **(link: https://www.youtube-nocookie.com/embed/ text: YouTube DNT target: _blank)** 
                      **(link: https://www.publicalbum.org/blog/embedding-google-photos-albums text: Google Photos Embed target: _blank)** 
            matomo:
              type: matomo-page
              overview: true

  seotab: seo
  filetab:
    icon: attachment
    label: Dateien
    sections:
      allfiles:
        headline: Alle Dateien ({{ page.files.count }} | {{ page.files.nicesize }})
        type: files
        layout: list
        info: "{{ file.nicesize }}"
        sortBy: size desc
        image:
          cover: true
bastianallgeier commented 3 years ago