DevExpress / AjaxControlToolkit

The ASP.NET AJAX Control Toolkit is a classic set of ASP.NET WebForms extensions.
https://devexpress.com/act
BSD 3-Clause "New" or "Revised" License
290 stars 137 forks source link

Ajax HtmlEditorExtender can't retain size when placed inside hidden panel on page load #552

Open vasanth15 opened 4 years ago

vasanth15 commented 4 years ago

The AJAX Control Toolkit \<20.1.0>

The installation method

Minimal steps to reproduce the bug

  1. Place HtmlEditorExtender targeting a textbox inside a panel and set the display property of panel to none using cssStyle,
  2. Verify that when the page loads, the panel is hidden.
  3. On button click, using javascript, change the display property of panel to block which makes the panel and items inside panel visible.
  4. Verify that all items inside panel grows back in size except HtmlEditorExtender.

CssStyle of panel:

    .auto-panel_property{
        display: none;
    }

HTML code:

<asp:panel ID="hidden_pnl" runat="server" CssClass="auto-panel_property">
    <asp:TextBox ID="email_box" runat="server" CssClass="auto-style119" TextMode="MultiLine"></asp:TextBox>
    <asp:HtmlEditorExtender ID="email_box_HtmlEditorExtender" EnableSanitization="true"
            runat="server" TargetControlID="email_box">
        <Toolbar>
            <ajaxToolkit:Undo />
            <ajaxToolkit:Redo />
            <ajaxToolkit:FontNameSelector />
        </Toolbar>
    </asp:HtmlEditorExtender>
</asp:panel>

if .auto-panel_property is modified to block, the rendering is fine but again, making it hidden through javascript on page load makes the user experience bit clumsy.

.auto-panel_property{
    display: block;
}

Actual result

The size of HtmlEditorExtender loses size when panel display property is set to none when page loads. image

Expected result

The size of HtmlEditorExtender should retain shape irrespective of the panel display property. image

Browser(s) used

Fails on chrome, edge.

A site deployment method

Ulf-Ason commented 3 years ago

Good morning, Dev Express! 9 months later and no reactions. If you have left this repo - just tell us!

au5ton commented 1 year ago

I am experiencing this bug as well.

I believe the bug is rooted in this line here:

https://github.com/DevExpress/AjaxControlToolkit/blob/d3ad8d0822c4584b8ebf54d041bb514b0007d1c2/AjaxControlToolkit/Scripts/HtmlEditorExtender.js#L343-L347

The getBounds() call uses HTMLElement.offsetWidth, which can be 0 if the element is hidden by some ways.

https://github.com/DevExpress/AjaxControlToolkit/blob/d3ad8d0822c4584b8ebf54d041bb514b0007d1c2/AjaxControlToolkit.Jasmine/Scripts/MicrosoftAjax.debug.js#L4214-L4224

Because the element is hidden, when it initializes the editor sets itself to a fixed size of zero. I'm kind of surprised that HtmlEditorExtender sets itself to a fixed size and is never updated.