Opened 9 years ago

Closed 9 years ago

Last modified 5 years ago

#3222 closed enhancement (notabug)

Simple way to position dialog on resize

Reported by: wichert Owned by: Scott González
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.

Change History (3)

comment:1 Changed 9 years ago by Scott González

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.

comment:2 Changed 8 years ago by mpaige

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.

comment:3 Changed 5 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.