AjaxControlToolkit icon indicating copy to clipboard operation
AjaxControlToolkit copied to clipboard

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

Open vasanth15 opened this issue 4 years ago • 2 comments

The AJAX Control Toolkit <20.1.0>

The installation method

  • [* ] NuGet package

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

  • [*] Interserver
  • [*] IIS Fails on both above mentioned servers.!

vasanth15 avatar Jul 30 '20 20:07 vasanth15

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

Ulf-Ason avatar Mar 12 '21 17:03 Ulf-Ason

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.

au5ton avatar Feb 06 '23 18:02 au5ton