Repository: strapi/strapi
File: packages/core/upload/admin/src/components/MediaLibraryInput/MediaLibraryInput.tsx (TypeScript)

Code before:
    const handleNext = () => {
      setSelectedIndex((current) => (current < selectedAssets.length - 1 ? current + 1 : 0));
    };

    const handlePrevious = () => {
      setSelectedIndex((current) => (current > 0 ? current - 1 : selectedAssets.length - 1));
    };

    const handleFilesUploadSucceeded = (uploadedFiles: Asset[] | File[]) => {
      setUploadedFiles((prev) => [...prev, ...uploadedFiles]);
    };

    let initiallySelectedAssets = selectedAssets;

    if (uploadedFiles.length > 0) {
      const allowedUploadedFiles = getAllowedFiles(
        fieldAllowedTypes,
        uploadedFiles as AllowedFiles[]
      );

      initiallySelectedAssets = multiple
        ? [...allowedUploadedFiles, ...selectedAssets]
        : [allowedUploadedFiles[0]];
    }

    const handleClickAsset = (asset: File) => {
      const selectedIndex = selectedAssets.findIndex((prevAsset) => prevAsset.id === asset.id);
      if (selectedIndex >= 0) {
        setSelectedIndex(selectedAssets.findIndex((prevAsset) => prevAsset.id === asset.id));
      }
    };

    const handleDoubleClickAsset = (asset: File) => {
      handleAssetEdit(asset);
    };

    return (
      <>
        <CarouselAssets
          ref={forwardedRef}
          assets={selectedAssets}
          disabled={disabled}
          label={label!}
          labelAction={labelAction}
          onDeleteAsset={handleDeleteAsset}
          onDeleteAssetFromMediaLibrary={handleDeleteAssetFromMediaLibrary}
          onAddAsset={() => setStep(STEPS.AssetSelect)}
          onDropAsset={handleAssetDrop}
          onEditAsset={handleAssetEdit}
          onNext={handleNext}
          onPrevious={handlePrevious}

Review comment (suggestion):
I don't really see the point of this event to be honest. The selected item will automatically change depending on the displayed asset so the click don't have any impact since it's already selected. I would keep the double click since it's a nice feature and the aria-selected attribute but not the click.

Code after:
      setSelectedIndex((current) => (current < selectedAssets.length - 1 ? current + 1 : 0));
    };

    const handlePrevious = () => {
      setSelectedIndex((current) => (current > 0 ? current - 1 : selectedAssets.length - 1));
    };

    const handleFilesUploadSucceeded = (uploadedFiles: Asset[] | File[]) => {
      setUploadedFiles((prev) => [...prev, ...uploadedFiles]);
    };

    let initiallySelectedAssets = selectedAssets;

    if (uploadedFiles.length > 0) {
      const allowedUploadedFiles = getAllowedFiles(allowedTypes, uploadedFiles as AllowedFiles[]);

      initiallySelectedAssets = multiple
        ? [...allowedUploadedFiles, ...selectedAssets]
        : [allowedUploadedFiles[0]];
    }

    const handleDoubleClickAsset = (asset: File) => {
      handleAssetEdit(asset);
    };

    return (
      <>
        <CarouselAssets
          ref={forwardedRef}
          assets={selectedAssets}
          disabled={disabled}
          label={label!}
          labelAction={labelAction}
          onDeleteAsset={handleDeleteAsset}
          onDeleteAssetFromMediaLibrary={handleDeleteAssetFromMediaLibrary}
          onAddAsset={() => setStep(STEPS.AssetSelect)}
          onDropAsset={handleAssetDrop}
          onEditAsset={handleAssetEdit}
          onNext={handleNext}
          onPrevious={handlePrevious}
          onDoubleClickAsset={handleDoubleClickAsset}
          error={error}
          hint={hint}
          required={required}
          selectedAssetIndex={selectedIndex}
          trackedLocation="content-manager"
        />

        {step === STEPS.AssetSelect && (
          <AssetDialog
            allowedTypes={allowedTypes as AllowedTypes[]}