On Saturday, October 28, 2017 at 12:17:28 AM UTC+2, mauloop wrote: > > Now click on any link in the page (both in the story or in the sidebar): > it seems that tiddlers are opened, but the page doesn't scroll to the > clicked tiddler. Il looks very strange to me that simply adding a newline > could change the wiki behaviour. >
Yea, ... You found a rare behaviour, that I did also experience some time ago, when I did experiment with my own custom ViewTemplates. ... The point here is, that the code, that you have to dig down, is buried deep in the "core internals". I was too lazy, and at that time I even couldn't, dig deep enough ;) ... I try to describe it as high level as possible :) --- high level info Scrolling in TW is handled by different story-views, that you can find in the "right-sidebar: tools" menu. At tiddlywiki.com there are 3 story-views - classic (default) - pop - zooming Each of them treat "showing, removing, scrolling" tiddlers in a slightly different way. ... There are several other plugins. ---- low level info Every storyview has a corresponding javascript module. classic.js, pop.js and zooming.js. ... Every js module implements a function named: .navigateTo() ---- high level info We can trigger this navigation function with eg: tw messages like tm-navigate <http://tiddlywiki.com/#WidgetMessage%3A%20tm-navigate> which are created by different elements. eg: buttons, (see link docs) tm-navigate is a user facing message, that can work with tiddler names. ... that's nice and easy (for users :) --- low level info When tm-navigate is executed, internally somewhere in the code a new low level message is triggered: tm-scroll <http://tiddlywiki.com/#WidgetMessage%3A%20tm-scroll> The tm-scroll message can't be directly used by the user, since it needs a DOM element as a target parameter, which can only be created by javascript. Within js we call this mechanism "event-mechanism" and tm-scroll is an event-name or short event. --- higher level info Starting with V5.1.9-beta <http://tiddlywiki.com/#Release%205.0.9-beta> jeremy introduced the scrollable-widget <http://tiddlywiki.com/#ScrollableWidget>which allows us users access to some of these mechanisms. The widget docs says: If a scrollable widget can't handle the tm-scroll message because the inner > DIV fits within the outer DIV, then by default the message falls through to > the parent widget. Setting the *fallthrough* attribute to no prevents > this behaviour. > Let's try a ASCII-art for the "fallthrough" mechanism: child | +-- parent | +-- grandparent So "child" triggers an event, but can't handle it. (That happens from time to time ;) That's why it hands the event down to the parent. ... The parent thinks: "I have no time", that's perfect for grandparent, so it's handed down again Grandparent knows what to do and does, what needs to be done ;) ... In case that the child want's to keep the event secret, it set's "fallthrough" to no and doesn't hand it over. --- low level info In case of the "new-line" that you introduced, it now looks like this. (still simplified) child | + new-line (stranger) +-- parent | +-- grandparent As every child should know. Don't trust strangers. So it doesn't pass on the event. And that's exactly what happens in the code <https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/storyviews/classic.js#L24>. It detects the "stranger" and doesn't pass on the event. ---- That's exactly what you describe. I first found something similar on a wiki I was working on, with a little > different result. In that case I had a *working* custom ViewTemplate > with more changes and I inserted some newline to make the code more > readable. When I saved the "beautified" ViewTemplate it happened that > clicking on any link raised a Javascript error. > > TypeError: this.getLastFrame(...).getBoundingClientRect is not a function > This shouldn't happen, because there are several "stranger" tests along the line. The point is. We can't navigate to whitespace, because the browser API doesn't provide enough info. We can only navigate to "wrapping" DOM elements. ---- low low level. The line that cause your js error is: https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/utils/dom/scroller.js#L63 ---- high level hope that makes sense and helps have fun mario -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d88322e9-a96e-4e06-8160-04cb765470e4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.