Skip to main content

Search and Top Navigation

#3222 closed enhancement (notabug)

Opened August 18, 2008 03:40AM UTC

Closed August 18, 2008 11:58PM UTC

Last modified October 11, 2012 09:15PM UTC

Simple way to position dialog on resize

Reported by: wichert Owned by: scottgonzalez
Priority: minor Milestone:
Component: ui.dialog Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:
Description

Instead of fixing the top and left position and hooking into window resize events there is a simple method to handle dialog positioning:

  • set ''top'' ''and'' left at 50%
  • set the ''margin-left'' and ''margin-top'' to the negative half width/height of the dialog

If you do this the browser itself will always position the dialog in the center of the screen. In addition this is simpler to style.

Attachments (0)
Change History (3)

Changed August 18, 2008 11:58PM UTC by scottgonzalez comment:1

resolution: → invalid
status: newclosed

Resizing should not reposition the dialog. That would be completely unexpected behavior by the user. Also, the solution you provide only works for dialogs that are centered and haven't been moved at all by the user.

Changed February 03, 2010 05:40PM UTC by mpaige comment:2

I disagree that this would be unexpected behavior. I believe that in most cases, this is the expected behavior. Point of fact, nearly all (if not all) lightbox/overlay scripts (not simple dialogs) work as reported by wichert (see above).

I understand that for a simple (modal) dialog this might not be the behavior the user might expect, but it is certainly the behavior when used as a lightbox/overlay.

Perhaps an option/flag allowing the user to decide the type of centering to be used (fixed/fluid) would be a valid enhancement.

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:3

milestone: TBD

Milestone TBD deleted