Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 363932

Summary: Alert in new HelloWorld sample needs fixing
Product: z_Archived Reporter: broy2
Component: EDTAssignee: Xiao Bin Chen <xiaobinc>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: smythew
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
RBD
none
EDT
none
Patch for this defect xiaobinc: iplog+, xiaobinc: review?

Description broy2 CLA 2011-11-16 11:04:22 EST
Created attachment 207099 [details]
RBD

The title in the alert of the HelloWorld sample overlaps the close icon.
The title in the alert when run in RBD is Alert and doesn't overlap the close icon.
The title when run in EDT is HelloWorldView and overlaps the close icon.
Screen shots of RBD and EDT attached.
Comment 1 broy2 CLA 2011-11-16 11:05:16 EST
Created attachment 207100 [details]
EDT
Comment 2 Lisa Lasher CLA 2011-11-16 16:35:55 EST
Please try to fix this by Monday, as it is very visible to users.
Comment 3 Will Smythe CLA 2011-11-16 16:44:06 EST
This bug is not specific to the Hello World example. It will occur anytime the message being displayed in a Dojo Dialog is shorter than the title text.

Agree this needs to get fixed.

I would think the Dojo dialog widget would account for this and increase the width of the dialog such that the title wouldn't get cut off. I would check the Dojo docs and see what it recommends.
Comment 4 Xiao Bin Chen CLA 2011-11-17 00:24:57 EST
Fixed.
Comment 5 broy2 CLA 2011-11-18 09:44:01 EST
Verified in 20111118.
Comment 6 broy2 CLA 2011-11-21 15:39:56 EST
I'm on the 20111121 build.
Type abc for the name and click Go.
The title overlaps the close icon.

It seems to depend on the name entered.
When I enter brenda, the title is OK.
Comment 7 Xiao Bin Chen CLA 2011-11-21 20:07:23 EST
fixed, adding the length of 'x' image consideration.
Comment 8 Xiao Bin Chen CLA 2011-11-21 20:28:50 EST
Tested below input:
a
ab
abc
abcd
abcde
abcdef
abcdefg

And it works correctly, if it does not works in your machine,please reopen it.
Comment 9 broy2 CLA 2011-11-22 10:01:59 EST
Verified in 20111122 build.
Comment 10 Will Smythe CLA 2011-11-23 10:29:16 EST
The current fix/implementation is not going to hold up in the scenario where the developer supplies a long (based on character length) message string, but the string (when rendered in the dialog) is not wider than the title. For example:

DojoDialogLib.showMessage("States", "AZ<br>CO<br>NM<br>VT", null);

This again causes the title to overrun the close X since the title string ("States") is shorter - based on string length - than the message string.

One logical solution is to avoid trying to compare the title and message string lengths when determining the width, since string length does not equate to the width of the string on the dialog. CSS has a "min-width" attribute that allows the browser to make a better decisions on the width of the dialog (in contrast to setting).

I replaced the current logic with the following line:
dialog.style = "min-width: " + title.length() + "em";

Note the dialog's minimum width is determined by the title's length (and only the title's length).
Comment 11 Will Smythe CLA 2011-11-23 10:31:06 EST
Here is an example where the current solution fails:

DojoDialogLib.showMessage("States", "AZ<br>CO<br>NM<br>VT", null);
Comment 12 Xiao Bin Chen CLA 2011-11-23 21:25:26 EST
Created attachment 207455 [details]
Patch for this defect
Comment 13 Xiao Bin Chen CLA 2011-11-23 21:34:24 EST
(In reply to comment #12)
> Created attachment 207455 [details]
> Patch for this defect


Test below case:
Title:
"t"
a
<br>a
ab
abc


"States'

a
ab
abc
abcd
abcde
AZ<br>CO<br>NM<br>VT
a<br>
a<br>a<br>
Comment 14 Xiao Bin Chen CLA 2011-11-23 22:05:14 EST
Resolved.
Comment 15 broy2 CLA 2011-11-29 13:23:01 EST
Verified in 20111129 build.