meglio  
                (Anton)
               
                 
                 
              
                  
                    February 18, 2025, 11:20am
                   
                   
              1 
               
             
            
              Reproduction steps:
1.  Enlarge chat: 
2.1.  Post a message with a medium to big image, so that you’d expect a popup with a larger image if you click on it in the message.
OR
2.2.  Receive such a message from other people in the chat.
3.  Click on the image. It won’t open.
Workaround:
4.  Refresh the page in the browser.
5.  Click on the image - it would now open a popup with a bigger size image.
             
            
               
               
              2 Likes 
            
            
           
          
            
              
                j.jaffeux  
                (Joffrey Jaffeux)
               
              
                  
                    February 19, 2025,  8:39am
                   
                   
              2 
               
             
            
              That’s a recent regression afayk?
             
            
               
               
              1 Like 
            
            
           
          
            
              
                pmusaraj  
                (Penar Musaraj)
               
              
                  
                    February 19, 2025,  9:25pm
                   
                   
              3 
               
             
            
              Yes, I have seen this today as well. Pretty sure it’s a recent regression.
             
            
               
               
              1 Like 
            
            
           
          
            
            
              I think the issue is here:
api.decorateChatMessage(
      (element) =>
        lightbox(element.querySelectorAll("img:not(.emoji, .avatar)")),
      {
        id: "lightbox",
      }
    );
 
Before, api.decorateChatMessage was passing .chat-message-container element:
After, it passes .chat-cooked element: 
With the images defined inside chat-message-collapser-body, lightbox can’t find the images here.
Changes introduced here: DEV: Refactor chat HTML decorating (#31309) · discourse/discourse@a0f681b · GitHub 
             
            
               
               
              4 Likes 
            
            
           
          
            
              
                j.jaffeux  
                (Joffrey Jaffeux)
               
              
                  
                    February 20, 2025,  8:25am
                   
                   
              6 
               
             
            
              Yes, sorry you dont see it, it’s a whisper but I have already pinged @david  about it. I also think this is related to this recent change.
Thanks for checking, I didnt have the time yet to prove my theory 
             
            
               
               
              4 Likes 
            
            
           
          
            
              
                david  
                (David Taylor)
               
              
                  
                    February 20, 2025, 10:09am
                   
                   
              8 
               
             
            
              Thanks @meglio  and @Arkshine !
Limiting the normal “decorate cooked” to only the message content is intentional. But we did add some specific lightboxing logic which was supposed to handle the images. Looks like that wasn’t handling the case where the original image is swapped out for the optimized version.
Fix here:
  
  
    
    
  
      
    
      main ← chat-image-lightbox
    
      
        
          opened 10:07AM - 20 Feb 25 UTC 
        
        
        
       
   
 
  
    When a message is first sent, the original upload URL is used for a split-second…  before it's replaced by the optimised thumbnail. Using `didInsert` didn't re-run on any changes to the uploads. Switching to a proper modifier, and checking the length of the uploads array within it, will ensure that it is re-run whenever the uploads change. 
   
   
  
    
    
  
  
 
             
            
               
               
              6 Likes 
            
            
           
          
            
              
                david  
                (David Taylor)
                  Closed 
               
              
                  
                    February 21, 2025,  8:00am
                   
                   
              9 
               
             
            
              This topic was automatically closed after 21 hours. New replies are no longer allowed.