Review main Merged

89140[BUGFIX] Load `draggable-resizable-element` in top-level scope

Andreas Kienast CR +2 V +2 Normal +91 −92 updated 04/28/25, 07:42

Commit message

The image cropping functionality allows to define so-named "focus areas"
to hint editors to respect a certain area while cropping pictures.

This functionality broke with #100948 in Firefox, as the web component
`@typo3/backend/element/draggable-resizable-element` is loaded within
the content frame context, but used in a modal window, which resides
in the outer backend scaffold context.

Explicitly loading the web component in top level is not enough, as
exports of said component are already loaded and used in
`image-manipulation`.

To solve this, several changes are done:

* the class `Offset` has been extracted into a new file and is now
  independently loaded in both affected modules, which avoids premature
  loading of `draggable-resizable-element` and therefore fixes the
  scoping in Firefox
* the consumers of `initFocusArea()` have been made async as well

Review

  • Code review CR +2 Done
    • Andreas Kienast +2
    • Benjamin Franzke +1
    • Garvin Hicking +1
  • Verified V +2 Done
    • Andreas Kienast +2
    • Benjamin Franzke +1
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 2

Files 6

Review log 2330

Show 45 earlier messages
  1. Andreas Kienast uploaded patch set 1 04/16/25, 11:16

  2. core-ci voted on patch set 1 V +1 04/16/25, 11:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77830

  3. Garvin Hicking commented on patch set 1 V -1 04/17/25, 07:06

    Thanks so much for chewing through this, however: Good news: Firefox shows the focus area, and no JS errors! Bad news: Neither Firefox, nor Chrome can move the focus area. Without the patch, in chrome I can move the focus area.
  4. Garvin Hicking commented on patch set 1 04/17/25, 07:06

    Reply

    (With TCA styleguide imagemanipulation, crop_7)
  5. Andreas Kienast uploaded patch set 2 V +1 04/17/25, 08:08

  1. core-ci voted on patch set 2 V +1 04/17/25, 08:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77879

  2. Garvin Hicking commented on patch set 2 CR +1 V +1 04/24/25, 17:24

    Thanks! I couldn't break it 😄
  3. Christian Kuhn voted on patch set 2 CR +1 V +1 04/24/25, 19:57

  4. Simon Schaufelberger commented on patch set 2 04/25/25, 00:53

    image-manipulation.ts:27

    ; missing
  5. Andreas Kienast commented on patch set 2 04/25/25, 05:22

    image-manipulation.ts:27 Reply

    A trailing semicolon is technically not necessary here as the compiling process handles this already. I'd rather invest time to check whether there's an eslint rule to enforce this (which will very likely affect other files as well).
  6. Benjamin Franzke uploaded patch set 3 CR +1 V +1 04/25/25, 05:27

  7. Benjamin Franzke commented on patch set 3 04/25/25, 05:27

    draggable-resizable-element.ts:101

    All these workarounds regarding `windowRef` and `documentRef` could (and should) now be removed, now that the element is properly created on the top-frame.

    image-manipulation.ts:27 Reply

    Done

    image-manipulation.ts:381

    Btw, I'm wondering why we need to await here. We shouldn't even have to await the top-level module load, since we could initialize the element set all properties and be fine with lazy initialization. It's also a bit strange that both `cropBuiltHandler` and `update` invoke `initFocusArea`, maybe that caused the issue Garvin mentioned (not being able to move in patchset 1) and we're now "hiding" issues caused by double-initialization. -1 for now, I'd like this to be checked/clarified.
  8. core-ci voted on patch set 3 V +1 04/25/25, 05:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78165

  9. Benjamin Franzke uploaded patch set 4 CR -1 V +1 04/25/25, 05:36

  10. Benjamin Franzke commented on patch set 4 04/25/25, 05:36

    draggable-resizable-element.ts:101 Reply

    Done
  11. core-ci voted on patch set 4 V -1 04/25/25, 05:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78166

  12. Benjamin Franzke uploaded patch set 5 CR -1 V -1 04/25/25, 06:07

  13. Benjamin Franzke commented on patch set 5 04/25/25, 06:07

    image-manipulation.ts:381 Reply

    Fixed.
  14. core-ci voted on patch set 5 V -1 04/25/25, 06:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78168

  15. Andreas Kienast uploaded patch set 6 CR +1 V +1 04/25/25, 06:20

  16. core-ci voted on patch set 6 V +1 04/25/25, 06:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78169

  17. Benjamin Franzke voted on patch set 6 CR +1 V +1 04/25/25, 06:33

  18. Garvin Hicking commented on patch set 6 CR +1 V +1 04/28/25, 06:41

    Verified in Safari, Chromium, Firefox on macOS. I adjusted the crop_7 EXT:styleguide example to also have multiple focus areas and that also works well (we could add that example in a separate patch, or not).
  19. Andreas Kienast voted on patch set 6 CR +2 V +2 04/28/25, 07:08

  20. Andreas Kienast uploaded patch set 7 CR +1 V +1 04/28/25, 07:10

  21. Garvin Hicking voted on patch set 7 CR +1 V +1 04/28/25, 07:11

  22. Benjamin Franzke voted on patch set 7 CR +1 V +1 04/28/25, 07:14

  23. core-ci voted on patch set 7 V +1 04/28/25, 07:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78266

  24. Andreas Kienast voted on patch set 7 CR +2 V +2 04/28/25, 07:17

  25. Andreas Kienast merged patch set 8 04/28/25, 07:42