Opened 5 years ago

Last modified 3 years ago

#18209 new defect

Dialog: does not position centered depending on content and window size

Reported by: skamaraj Owned by: bill
Priority: undecided Milestone: 1.15
Component: Dijit Version: 1.10.0
Keywords: Cc:
Blocked By: Blocking:

Description

http://jsfiddle.net/9Ub83/34/

Depending on the content and size of the window, dialog's contents are not correctly resized to fit in the viewport. As a result dialog is not centered. Following code in resize() in https://github.com/dojo/dijit/blob/master/Dialog.js needs to be modified to be (bb.x+bb.w) >= viewport.w to trigger the content wrapping.

Change History (6)

comment:1 Changed 5 years ago by bill

Component: GeneralDijit
Owner: set to bill

Following code in resize() in

​>https://github.com/dojo/dijit/blob/master/Dialog.js needs to be modified to be (bb.x+bb.w) >= viewport.w to trigger the content wrapping.

Huh? Which code in resize()? Can you give a line number or snippet of original code? Thanks.

Last edited 5 years ago by bill (previous) (diff)

comment:2 Changed 5 years ago by skamaraj

https://github.com/dojo/dijit/blob/master/Dialog.js#L428. This will set the dim and shrunk boolean to true and the container node's contents will be wrapped in the subsequent code I guess. I have done debugging on 1.9.3 version and it fixes the issue in _size method. I have not done debugging on 1.10.0 but from the fiddle, I still see that the content is not shrunk correctly, hence the fix I am assuming might still be valid.

comment:3 Changed 5 years ago by bill

I see... it's a strange code change, because Dialog sizing shouldn't depend on bb.x since that's effectively a random value, dependent on where the dialog happens to be positioned before we actually set the position.

Perhaps it's that we need to move the dialog to the far left (or far right, in RTL mode) before measuring the width.

Last edited 5 years ago by bill (previous) (diff)

comment:4 Changed 5 years ago by skamaraj

That sounds correct. We need to move the dialog to the far left before measuring the width. My previous code snippet assumed that by default first time, dialog is positioned far left which means x will be 0. If x is non zero, then check should always be that dialog's left + dialog's width is within the viewport width. Thanks for looking into this.

comment:5 Changed 3 years ago by dylan

Milestone: tbd1.12

comment:6 Changed 3 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.