microsoft / BotFramework-WebChat

A highly-customizable web-based client for Azure Bot Services.
https://www.botframework.com/
MIT License
1.6k stars 1.55k forks source link

Fix: modal rendering when opened #5374

Closed OEvgeny closed 1 week ago

OEvgeny commented 1 week ago

Fixes #

Changelog Entry

Fixed

Description

This PR addresses visual inconsistencies that occur when opening modal dialogs in Web Chat, particularly in code view scenarios. The changes ensure smoother transitions and prevent unwanted visual artifacts during modal rendering.

Design

The solution implements several key improvements:

  1. Uses useLayoutEffect instead of useEffect for modal operations to ensure synchronous DOM updates
  2. Adds conditional rendering for code content to prevent flash of empty modal
  3. Implements CSS visibility handling that allows content components to return nothing without triggering modal display
  4. Fixes edge cases with empty text in code blocks: we now don't display the button

Specific Changes

-

Review Checklist