[Dojo-interest] scrolling layoutPanes seeking anchors

Brian Duchek bduchek at iconclude.com
Mon Apr 3 19:50:12 MDT 2006


Has anyone experienced any weirdness related to trying to target anchors
located within the clientAlign panel of a LayoutPane?  I'm having a
head-scratcher of a dojo/css problem here, and only in FF1.5

Here's my description of the problem I'm experiencing.

Below is the basic outline of my page structure. The dotted line
illustrates the bottom of the scrolling portion of the middle content
panel (i.e. the 'fold').

--------------------------------
| heading: layoutAlign=top     |
--------------------------------
| content: layoutAlign=client ||
|                             ||
| link 1                      ||
| link 2                      ||
| link 3                      ||
|..............................|
| footer: layoutAlign=bottom   |
--------------------------------

My address looks like this. See the anchor on the end, in the #fragment
part of the URL?

http://hostname/MyApp/app?service=some_server_id_junk#ID_of_link5

There's some content below the fold in my layout pane that lives inside
the content panel that has its id="ID_of_link5".  The intention is that
the ID element which matches the URL fragment portion will be 'focused
on' by the browser when it loads.  It's commonly known as "in-page
anchors" or something like that.

The _actual_ behavior is that the entire HTML block of content gets
shifted up negatively in the view pane, and since LayoutPane requires
the html element be styled with overflow:hidden; there's no way to even
scroll the page down.  Here's an approximation of what this condition
looks like:

The x's represent the border of the view pane.  

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x|                             ||x
x| link 4                      ||x
x| link 5                      ||x
x| link 6                      ||x
x|..............................|x
x| footer: layoutAlign=bottom   |x
x--------------------------------x
x                                x
x                                x 
x                                x
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Could this be a problem caused by the timing conflict between the
browsers native rendering and fragment-focusing behavior, and the Dojo
DOM manipulation routines related to parsing widgets?

i.e. the browser is positioning itself to the location of the "unparsed
widget" state, and then Dojo goes and re-writes everything and it isn't
resetting the scrolling position to 0 when it initializes.

I've gotten only as far as using some additional onLoad scripting:

if(dojo.html.getScrollTop()!= 0){
          document.documentElement.scrollTop = 0;
          document.body.scrollTop = 0;

          url = window.location.href;
          element = url.substring(url.indexOf("#")+1, url.length)
          dojo.html.selectElement(element)
    }

However, selectElement isn't working as expected (it does nothing).

If anyone has any further insight into this fun problem, your feedback
would be greatly appreciated. :)

</bd>


More information about the Dojo-interest mailing list