Review main Abandoned

92439[BUGFIX] Restore file selection logic in element browsers

HOJA M A CR -2 V 0 Easy +36 −14 updated 10/02/26, 12:27

Commit message

A previous refactoring introduced a regression where the
IsFileSelectableEvent was wrongly placed inside the
resourceDisplayMatcher of the FileBrowser. This caused the
file selection logic to act as a display filter.

Move the IsFileSelectableEvent back to the
resourceSelectableMatcher in the FileBrowser class to fix
the selection behavior. Furthermore, copy this exact
resourceSelectableMatcher logic to the FileLinkHandler to ensure
links created via the RTE are processed identically to record
relations for selectable files.

Review

  • Code review CR -2
    • Benjamin Kott -2
    • Garvin Hicking -1
  • Verified V 0
    • core-ci +1 CI

Issues 1

Files 2

Review log 2939

Show 814 earlier messages
  1. HOJA M A uploaded patch set 1 01/21/26, 11:29

  2. HOJA M A updated the commit message in patch set 2 01/21/26, 11:35

  3. core-ci voted on patch set 1 V +1 01/21/26, 11:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93937

  4. HOJA M A updated the commit message in patch set 3 01/21/26, 11:44

  5. core-ci voted on patch set 2 V +1 01/21/26, 11:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93939

  6. core-ci voted on patch set 3 V +1 01/21/26, 11:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93940

  7. Stefan Froemken commented on patch set 3 CR -1 01/27/26, 14:43

    FileBrowser.php:84

    You only add just ONE Matcher. So, no AndMatcher needed here.

    FileBrowser.php:94

    If you remove the ResourceFileExtensionMatcher the AndMatcher here is not needed anymore.

    FileBrowser.php:95

    Why adding the ResourceFileExtensionMatcher here again. If a file would not match that would be handled by $this->resourceDisplayMatcher. And if a file is not there, nothing can be selected.
  8. HOJA M A commented on patch set 3 01/27/26, 15:11

    @froemken@gmail.com You're absolutely right. Since you are only registering a single matcher now, the AndMatcher was redundant overhead. It's much cleaner to add the anonymous class directly to the resourceSelectableMatcher.
  9. HOJA M A uploaded patch set 4 CR -1 V +1 01/27/26, 16:52

  10. core-ci voted on patch set 4 V -1 01/27/26, 17:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94440

  11. HOJA M A rebased onto patch set 5 V -1 01/27/26, 22:47

  12. core-ci voted on patch set 5 V +1 01/27/26, 22:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94455

  13. HOJA M A uploaded patch set 6 V +1 01/28/26, 19:33

  14. core-ci voted on patch set 6 V +1 01/28/26, 19:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94528

  1. Benni Mack updated the commit message in patch set 7 V +1 04/22/26, 06:40

  2. core-ci voted on patch set 7 V -1 04/22/26, 08:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100758

  3. Stefan Froemken rebased onto patch set 8 V -1 05/19/26, 10:24

  4. core-ci voted on patch set 8 V +1 05/19/26, 10:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102205

  5. Stefan Froemken uploaded patch set 9 V +1 05/19/26, 14:36

  6. Stefan Froemken commented on patch set 9 05/19/26, 14:38

    FileBrowser.php:84 Reply

    Done

    FileBrowser.php:94 Reply

    Done

    FileBrowser.php:95 Reply

    Done
  7. core-ci voted on patch set 9 V +1 05/19/26, 14:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102233

  8. Markus Klein voted on patch set 9 CR +1 05/19/26, 15:18

  9. Josef Glatz commented on patch set 9 05/20/26, 04:40

    This sentence needs an update. I think …files are identivally to…
  10. Stefan Froemken updated the commit message in patch set 10 CR +1 V +1 05/20/26, 05:31

  11. Stefan Froemken commented on patch set 10 05/20/26, 05:32

    Good catch, thanks. Using the passive "are processed identically to" makes the grammar clean and prevents any confusion with "RTE process" as a noun. I'll update the text.
  12. core-ci voted on patch set 10 V +1 05/20/26, 05:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102251

  13. Stefan Froemken commented on patch set 10 05/20/26, 05:50

    Reply

    Done
  14. Benjamin Kott commented on patch set 10 05/20/26, 09:26

    i think we have a misunderstanding here, and the problem is the event name itself is confusing, it works as intended as far as i can see the IsFileSelectableEvent IS a display filter, this is also described in the original bugfix https://github.com/TYPO3/typo3/commit/000057083adb17c641939dd18ebfc97a0a98ae08
  15. Benjamin Kott commented on patch set 10 CR -2 05/20/26, 09:30

    blocking this for now as it reintroduces and reverts the original bugfix, please see reasoning in the commit message: https://github.com/TYPO3/typo3/commit/000057083adb17c641939dd18ebfc97a0a98ae08
  16. Stefan Froemken commented on patch set 10 05/21/26, 21:56

    # Evaluation of the historical core logic regarding IsFileSelectableEvent To clear up the fundamental misunderstanding about the intent, the historical behavior, and the regressions introduced in patch +89624, I have analyzed the core source code down to TYPO3 v11. ## TYPO3 11 (Historical baseline) In EXT:recordlist (FileBrowser.php), the selection logic was controlled via: `protected function fileIsSelectableInFileList(FileInterface $file, array $imgInfo)` When returning `false` here (e.g., for specific file name patterns), the file was explicitly STILL VISIBLE. However, the checkbox vanished, the title link was disabled, the thumbnail link was disabled, and the "+" icon disappeared. Proof: The element browser was explicitly built to render non-selectable items as visible but disabled. ## TYPO3 12.1 (Introduction of the Event) Based on Forge #99118, the `IsFileSelectableEvent` was introduced. The implementation clearly bound the event to the selection status: `$resourceView->isSelectable = $this->eventDispatcher->dispatch(new IsFileSelectableEvent($resource))->isFileSelectable();` The event was explicitly designed to mimic the old v11 behavior, deciding whether a file is *selectable*, not whether it is *visible*. ## TYPO3 12.3 (The element browser rework) With the introduction of the tile view (Feature #99861), the event was moved from the FileBrowser into the FileList class. The logic remained intact: it still controlled `$resourceView->isSelectable`. Non-selectable items were still rendered as disabled in the tiles/list view, which was completely correct. ## TYPO3 13.4.10 (Fixing the primary action click) Forge #106560 addressed a minor bug where users could still select a file by clicking its title link, even though the checkbox was disabled. Patch +89064 fixed this primary action bypass correctly. Everything was fully functional at this point. ## TYPO3 13.4.15 (The regression patch +89624) Patch +89624 tried to fix a side effect regarding folder title links, but the commit message introduced several false assumptions: 1. Citation: "Displaying disabled items was never intended." Fact: As proven by v11 and v12 code, it was explicitly intended and widely used. 2. Citation: "a file that is not selectable should never be shown to the user in the first place." Fact: This breaks valid production use cases, such as showing files with missing mandatory metadata (copyright/creator) so editors can click "edit metadata" directly inside the browser instead of jumping back to the filelist module. 3. Citation: "The event has now been relocated and is exclusively used in the FileBrowser, as originally intended." Fact: Moving it inside the `resourceDisplayMatcher` turned a selection event into a display filter. ## Conclusion This is not a feature request for v15. This is a severe regression bugfix. Patch +89624 accidentally killed a long-standing core capability and broke the architectural meaning of the `IsFileSelectableEvent`. If an event is named "IsFileSelectable", it belongs in the `resourceSelectableMatcher`, not the `resourceDisplayMatcher`. This current patch restores the original, correct behavior by moving the event back to the selection context in FileBrowser and synchronizing this missing part into FileLinkHandler, without hiding files and breaking the expected backend user experience. Please re-evaluate the code history based on these facts.
  17. Garvin Hicking commented on patch set 10 CR -1 05/22/26, 10:26

    Reply Unresolved

    Sorry, only glancing at this and not taking a deep dive, but my thoughts are: I think providing the file selector popup (unlike the full media view) with files that are not selectable is not a good UI/UX. I think it broadens the scope and leads to frustration because people say "I can see this, why can't I select it". It could be part of a proper editorial guidance to educate editors that certain conditions must be met for files. Like the element for references could receive a hint like "files must have metadata" or something like that. Or maybe even let the file selector popup show an info window like "17 files are filtered because they have no metadata. go edit these in the media list [link]". I would argue "fixing" this is a user-facing regression then and also a breaking change for people that implemented the event how it stands currently. So, if at all, a solution must be found to have the event be able to tell "hide the file" (default) or "make the file unselectable" (opt-in). (Also I believe the current patch removes the "getDisallowedFileExtensions" logic?)
  18. Stefan Froemken commented on patch set 10 05/22/26, 14:05

    To reach a common understanding of why this is a regression and not a feature request, we need to look at the official documentation and the architectural history of this specific API. ## Documentation and API contract (The breaking change argument) When the `IsFileSelectableEvent` was introduced (Patch +76663), its behavior and purpose were explicitly documented in the official RST file: "A new PSR-14 IsFileSelectableEvent has been introduced. It allows to define whether a file can be selected in the File Selector. This was previously only possible by overriding the FileBrowser->fileIsSelectableInFileList() method via a XClass." Patch +89624 changed this behavior fundamentally by turning a selection event into a display filter, but it did NOT include an RST documentation file to declare this breaking change or deprecation of the original API intent. Extension developers who implemented this event following the official documentation were left with a broken workflow where files suddenly vanished completely without notice. Therefore, restoring the documented behavior is the actual bugfix. ## Core API vs. Extension-level UX Citation: "I think providing the file selector popup with files that are not selectable is not a good UI/UX [...] people say 'I can see this, why can't I select it'" This interface capability can be traced back as far as TYPO3 7.6. The TYPO3 Core provides a powerful, decoupled framework with four distinct matchers (download, display, selectable, selected). It is the responsibility of the extension developer or integrator using these APIs to design the exact UX, not the Core's. In custom implementations, we already handle this by injecting informative header messages inside the element browser or adding hints to the form fields (e.g., "files must have metadata"). The Core shouldn't preemptively restrict API capabilities by hiding resources just because the default core templates don't provide tailored informational boxes out of the box. ## Real-world Editorial Workflows (The metadata use case) Citation: "go edit these in the media list [link]" Redirecting editors to a completely different module breaks the editing context. If an editor needs to relate 17 files but some lack mandatory metadata (like creator or copyright), sending them to the Filelist module destroys their current working state. TYPO3 v14 introduces great advancements in keeping editors in context. By rendering the non-selectable files as visible, editors can click the "edit metadata" action directly inside the element browser, save the properties, and continue their work right where they are. Forcing a hard separation by hiding files counteracts this modern UX philosophy. ## Separation of Concerns (One event per matcher) Citation: "a solution must be found to have the event be able to tell 'hide the file' (default) or 'make the file unselectable' (opt-in)" Using flags inside a single event to toggle between "hide" and "disable" creates a highly confusing API, especially since it would require attaching the same event to two entirely different matchers (`resourceDisplayMatcher` and `resourceSelectableMatcher`). The clean architectural solution is a strict separation of concerns: `IsFileSelectableEvent` belongs back in the `resourceSelectableMatcher` context to fulfill its documented purpose. If there is a legitimate need to filter the visibility of files via a PSR-14 event, a new, dedicated `IsFileDisplayableEvent` should be introduced for the `resourceDisplayMatcher`. I am more than willing to provide a follow-up patch that introduces this separate visibility event, but we should first restore the established selection API to its correct and documented state.
  19. Markus Klein commented on patch set 10 05/24/26, 06:28

    Reply

    Regarding UX and non-selectable items: Look at any Desktop Applications' menu, there are a lot of "grayed out" menu items. In the context of the file browser a non-selectable item by itself still conveys an important message: "You are still in the right folder, what you've expected is still there, you just can't use it in this context now." That being said, I'm fully with Stefan here!! Core must not make assumption in such regards about valid or invalid use cases. This is API for extensions, those need to know the use case.
  20. Garvin Hicking commented on patch set 10 05/24/26, 08:35

    Reply

    I understand. I think we should address this properly then and have to events, one for hiding completely, and one for "making unselectable".
  21. HOJA M A commented on patch set 10 05/27/26, 12:07

    Reply Unresolved

    Yeah @froemken@gmail.com That's exactly the points I wanted to share. Thanks alot for your detailed explanation with use cases. There is a fundamental misunderstanding regarding the architectural role of IsFileSelectableEvent with a display filter (If a display filter required it should be another event for example IsFileDisplayable). Restoring this behavior to its documented intent is absolutely a bugfix and crucial for extension compatibility. When IsFileSelectableEvent was introduced to replace the legacy FileBrowser->fileIsSelectableInFileList() XClass pattern, its API contract was clearly defined: it determines if a file can be clicked/selected, not whether it is visible. By moving this event to the resourceDisplayMatcher, the Core fundamentally changed a selection event into a visibility filter without any deprecation strategy or documentation. Extension developers who implemented this based on the official documentation found their workflows broken because files suddenly vanished from the browser entirely. This patch fixes that regression. #### The UI/UX Implementation Gap (The Double-Click Selection Flaw) There is a valid concern raised about UI/UX consistency, but it stems from an implementation gap in the default core markup, not the event itself. Currently, when `IsFileSelectableEvent` is fired: 1. The extension can successfully remove the **`+` (Selection Icon)** via the event states. 2. **The Problem:** The file name itself remains wrapped in a standard HTML link tag that triggers the file selection click/double-click event. Because the Core currently lacks a clear guideline or data-attribute standard in its templates to handle conditional pointer-events or disabled states on the file link text, developers are left with a half-broken UI where the icon disappears but clicking the file name still triggers the selection handler. Fixing this requires moving the event back to the `resourceSelectableMatcher` so templates can cleanly evaluate `isSelectable` to toggle both the icon visibility *and* the link attributes (e.g., adding `pointer-events: none` or stripping the `href/action` bindings). Hiding the files completely to avoid updating the template markup is the wrong architectural shortcut.

    FileBrowser.php:84 Reply

    Done

    FileBrowser.php:94 Reply

    Done

    FileBrowser.php:95 Reply

    Done
  22. Garvin Hicking commented on patch set 10 05/27/26, 13:01

    I kind of feel we're letting LLMs argument here and talk to each other. That's not a good use of time for me. ;) But I'm all for having two events to be able to cover both scenarios (hiding a file from being displayed at all, and having it displayed but not selectable).
  23. HOJA M A commented on patch set 10 05/27/26, 14:00

    Reply

    Hi @garvin@hick.ing Does the content drafted with LLM become a problem? ;) Arguments are still explained in the ticket and Stefan's point, and regarding the actual topic: yes, I completely agree there should be two separate events to cover both scenarios properly. Currently, moving the IsFileSelectableEvent into the display-file position is not a good idea because “displaying a file” and “selecting a file” are two different responsibilities with different use cases.
  24. Garvin Hicking commented on patch set 10 05/27/26, 15:11

    Reply

    I mailed this to Stefan: The only public TER consumer of the events is his extension. Thus I think moving IsFileSelectableEvent to the new place would be fine for me personally. The allowedFile thing though needs addressing. A new event could be called "IsFileDisplayedEvent", that could cover the current implementation of completely hiding an event. Then we should have an i portant.rst file alongside, this should mention the change in functionality and mention the new replacement event to covee the usage scenario that is regarded a regression. I think then everybody should be happy?
  25. Garvin Hicking abandoned the change 10/02/26, 12:27

    I'll have to abandon this due to no progress, feel free to reopen if this becomes sorted out :)