Skip to content

Commit

Permalink
Position: Handle sub-pixel offsets better in Firefox. Fixes #6000 - P…
Browse files Browse the repository at this point in the history
…osition: Sometimes positioning is off by 1px in Firefox.
  • Loading branch information
scottgonzalez committed Oct 22, 2010
1 parent 19f9c3a commit 32264f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui/jquery.ui.position.js
Expand Up @@ -122,8 +122,8 @@ $.fn.position = function( options ) {
}

// prevent fractions (see #5280)
position.left = parseInt( position.left );
position.top = parseInt( position.top );
position.left = Math.round( position.left );
position.top = Math.round( position.top );

collisionPosition = {
left: position.left - marginLeft,
Expand Down

1 comment on commit 32264f7

@jitter
Copy link

@jitter jitter commented on 32264f7 Oct 22, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes breaks another few dialog-unit-tests across all browsers. All seem to be 1px off failures.

When fixing this maybe you find time to fix a long-standing bug over all Opera versions. Using position bottom on a dialog on a page where the content doesn't fit into the visible area (has vertical scrollbars) and where the dialog itself has no focusable content makes Opera scroll the page.

e.g.
http://jsbin.com/atesu3/2 (page scrolls)
http://jsbin.com/atesu3/3 (everything fine page can't scroll - if window large enough)
http://jsbin.com/atesu3/4 (everything fine page doesn't scroll as input captures the focus and the focus-bubbling to body doesn't trigger the bug)

The same problem actually happens if I recall correctly in all directions (top, left, right) if the browser window can be scrolled in that direction

Please sign in to comment.