This project is archived and is in readonly mode.

#544 ✓invalid
fyrye

getCoordinates + textarea

Reported by fyrye | January 8th, 2009 @ 06:05 AM | in 2.0 (closed)

when a textarea is used in conjuction with getcoordinates, by default the value returned is correct, but when the textarea is scrolled either x/y the coordinates returned are incorrect by the number of pixels the font uses to push to the overflow.

Comments and changes to this ticket

  • Valerio

    Valerio January 8th, 2009 @ 07:22 AM

    • State changed from “new” to “invalid”

    Not enough info.

    Please, update this ticket with all the usual information, or dont bother opening tickets.

  • fyrye

    fyrye January 8th, 2009 @ 06:47 PM

    mootools version 1.2.1 doctype <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    When binding the getCoordinates() to a textarea similar to below

    
    <script type="text/javascript">
    window.addEvent('domready', function(){
    $('myTextarea').addEvent('blur', function(){
    	alert('Left: ' + $('myTextarea').getCoordinates().left + '\nTop: ' + $('myTextarea').getCoordinates().top + '\nRight: ' + $('myTextarea').getCoordinates().right + '\nHeight: ' + $('myTextarea').getCoordinates().height + '\n Width: ' + $('myTextarea').getCoordinates().width);
    	});
    });
    </script>
    
    
    <textarea id="myTextarea" style="width:10px;height:60px;">HORIZONTAL CONTENT</textarea>
    

    The returned results of the top/left coordinates of the element are returned to where the cursor is inside of the textarea. Unless this is the intended function of getCoordinates()

    My first post, no info on posting formats from what I see or who to assign to which sections of the API, perhaps updating your response with something more like.

    Not enough info.. Please update "this" ticket based on the following format [link to format rules]

    I do hope this is enough info to help you resolve this bug with mootools in the future. As the textare technically never moves, just the contents within. I original provided enough information to determine, getCoordinates and scrolling textarea is returning incorrect coordinates. I did the same here, but provided you with the code to show you results. I fixed the source code on my end, but seeing as how it's probably not enough information to fix it I won't bother posting my code here.

  • Tomas R

    Tomas R September 22nd, 2011 @ 11:20 PM

    • Milestone order changed from “0” to “0”

    Was this ticket ever completed/started/looked at?

    What the OP was saying is that when you first getCoordinates() of a textarea the correct results are given, but when you have content in the textarea that has scrolled the textarea vertically or horizontally the top and left coordinates are given as where the content starts which is not the top of left of the textarea.

    Imagine you get the coordinates of a textarea onFocus, with no content the right coordinates are returned. Later with overflowed content in the textarea you click on the textarea triggering the onFocus event and this time it will give you the original top - scroll.

    Was this ever fixed in any version of MooTools, it certainly is not fixed before 1.3.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Pages