Open Bug 314087 Opened 15 years ago Updated 2 years ago

Focus() to input field scrolls document to top

Categories

(Core :: DOM: Core & HTML, defect, P5)

1.8 Branch
x86
Windows XP
defect

Tracking

()

UNCONFIRMED

People

(Reporter: jay, Unassigned)

Details

Attachments

(1 file, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051006 Firefox/1.4.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051006 Firefox/1.4.1

Using the attached .html and javascript, scroll down below the "Rows" and click on "Click here to edit and scroll".  This is a degenerate version of an inplace-editor javascript from script.aculo.us.  It hides the <P> element, and inserts a <form> and <input> element directly before the <P>.  It then attempts to select() the new input field.

When I call select(), Firefox 1.0 immediately scrolls to the top of the page.  Firefox 1.5 blinks and then focuses on the input field.  Other browsers (IE, Safari) go directly to the input field.

If you instead click on "Click here to edit without scrolling", you'll call a very similar routine that uses setTimeout() to wait 1 ms before calling focus().  That does NOT scroll or blink; it works as intended!

Similarly, anything that will cause a delay - an alert() box, or stepping through with Venkman - will prevent the problem.  So I'm guessing it's a race condition that's somewhat, but not completely, better in 1.5.

Reproducible: Always

Steps to Reproduce:
Attached file HTML for failcase reproduction (obsolete) —
Attached file Javascript for failcase reproduction (obsolete) —
Attached file usable testcase
If you absolutely need multiple files for a testcase, please attach the dependent files first, so you can get the filename for the attachements, and then edit the HTML to refer to those files. In this case, where you don't appear to need more than one, using just one is a whole lot more convenient.
Attachment #201038 - Attachment is obsolete: true
Attachment #201039 - Attachment is obsolete: true
Assignee: nobody → general
Component: General → DOM
Product: Firefox → Core
QA Contact: general → ian
Summary: Focus() to input field scrolls document to top → Focus() to input field scrolls document to top
Version: unspecified → 1.8 Branch
Assignee: general → nobody
QA Contact: ian → general
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.