Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ScrollView should scroll to textfield when focused (or not). #1301

Closed
tolmasky opened this Issue · 12 comments

7 participants

@tolmasky
Collaborator

If we have a textfield within a scrollview, giving it focus scrolls the underlying div, but does not actually scroll the scrollview (the scrollers show the old position, etc). As such, we should either make the scrollview match the new position, OR prevent the underlying div from scrolling.

@nicomagni

Did anyone fix this? I have a big form with a scroll view.. how can I fix it?

@Me1000

I believe the fix is as simple as adding

[self scrollRectToVisible:[self frame]];

To -becomeFirstResponder

@cappbot
Collaborator

Label: #new. What's next? A reviewer should examine this issue.

@tolmasky
Collaborator

This problem was a little more subtle. Its not just about calling scrollRectToVisible. The issue is that the underlying textfield DOM element, when focused, will scroll the parent div no matter what, so basically there is a situation where the divs could be out of sync with what cappuccino thinks is the state of the world.

@aljungberg
Owner

Automatic scrolling by the browser is very difficult to prevent I found out: http://stackoverflow.com/questions/2467386/how-can-safari-be-prevented-from-scrolling-an-overflowhidden-iframe

That's about iframes, but I wouldn't be surprised if it's similarly hard to stop the browser here.

@ggsato

+AppKit
+#needs-review

@cappbot
Collaborator

Labels: #needs-review, #new, AppKit. What's next? This issue is pending an architectural or implementation design decision and should be discussed or voted on.

@mrcarlberg mrcarlberg referenced this issue from a commit in mrcarlberg/cappuccino
@mrcarlberg mrcarlberg Make sure the text field is visible before focus so the browser
will not scroll without the NSScrollView knowing about it
Issue #1675 and maybe a little of issue #1301
This fix will not work without pull
request #1678 - Fixed scrollRectToVisible in CPView
182f4c3
@ahankinson

-#new

@cappbot
Collaborator

Labels: #needs-review, AppKit. What's next? This issue is pending an architectural or implementation design decision and should be discussed or voted on.

@cappbot
Collaborator

Milestone: Someday. Labels: #needs-review, AppKit. What's next? This issue is pending an architectural or implementation design decision and should be discussed or voted on.

@ahankinson

I believe this was fixed in 481f7c6

+#fixed

@cappbot
Collaborator

Milestone: Someday. Labels: #fixed, AppKit. What's next? This issue is considered successfully resolved.

@cappbot cappbot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.