Images in an enlarged chat cannot be opened after a message with the image is posted

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

5 Likes