{"action":"created","issue":{"url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/2120","labels_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/2120/labels{/name}","comments_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/2120/comments","events_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/2120/events","html_url":"https://github.com/Jermolene/TiddlyWiki5/issues/2120","id":121051392,"number":2120,"title":"core PopupWidget","user":{"login":"tobibeer","id":97566,"avatar_url":"https://avatars.githubusercontent.com/u/97566?v=3","gravatar_id":"","url":"https://api.github.com/users/tobibeer","html_url":"https://github.com/tobibeer","followers_url":"https://api.github.com/users/tobibeer/followers","following_url":"https://api.github.com/users/tobibeer/following{/other_user}","gists_url":"https://api.github.com/users/tobibeer/gists{/gist_id}","starred_url":"https://api.github.com/users/tobibeer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobibeer/subscriptions","organizations_url":"https://api.github.com/users/tobibeer/orgs","repos_url":"https://api.github.com/users/tobibeer/repos","events_url":"https://api.github.com/users/tobibeer/events{/privacy}","received_events_url":"https://api.github.com/users/tobibeer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-08T16:59:24Z","updated_at":"2015-12-10T11:54:42Z","closed_at":null,"body":"Based on the considerations of #1432, it is necessary to be able to have popups that are created outside the flow, i.e. not at the place where a reveal widget is rendered, most importantly to have their style and rendering be independent from the anchoring element context.\r\n\r\nFor this purpose, this is an issue to discuss the specifics of creating a new, generic PopupWidget, which has (at least) the following attributes...\r\n\r\n* **template**\r\n    * the template tiddler used for rendering a popup\r\n* **class**\r\n    * a css class assigned to the actually created popup, not the PopupWidget\r\n        * overriding any default class, i.e. `tc-popup`\r\n\r\npossibly considering the following requirements...\r\n\r\n1. a popup element is immediately rendered as the PopupWidget renders...\r\n    1. which can be deferred, like now, using a RevealWidget or ListWidget\r\n1. by calling a $wiki method that...\r\n    1. knows the default place where to render popups (some placeholder in the PageTemplate)\r\n    1. renders a popup at the PopupWidget being its anchor\r\n    1. returns a reference to the rendered element to the PopupWidget\r\n        1. also stores a reference to the PopupWidget (being the anchor) at the actual popup\r\n1. the actual popup-element has a click handler which...\r\n    1. closes any child-popups, should a rendered popup contain and render another PopupWidget, thus rendering a nested child popup\r\n    1. this requires for the $wiki method handling popups to be aware of a PopupWidget instance to exist within the global popup-placeholder and to thus notify any associated parent PopupWidget of its existence\r\n        1. any PopupWidget may only have a single parent PopupWidget, not more\r\n        1. note that, here, \"parent\" does not mean \"parent in the dom\"\r\n        1. put differently, at a given level, only one child popup can be \"spawned\"\r\n        1. so, if a child popup is created from a PopupWidget within a popup, then any existing child popup already open with respect to that popup is to be closed, so that there is only ever one child per popup level\r\n        1. level 0 being anywhere in the pagetemplate except withing the placeholder for popups\r\n    1. it also requires a propper destructor for both the PopupWidget as well as the rendered popup\r\n        1. should the PopupWidget be destroyed, then so must be any rendered popups, including child popups\r\n        1. should a rendered popup be destroyed, then so must be any child popups\r\n1. clicking anywhere but a popup should always close all rendered popups of all levels\r\n1. which core elements should use the new popup mechanism or perhaps benefit from the old needs step-by-step consideration\r\n1. the place where the $wiki method renders actual popups could, in fact, be the first instance of a PopupWidget in the document that does not specify any (**template**) attribute\r\n    1. so one that just reads `<$popup/>`\r\n    1. that way we only need to make sure that this place is as permanent as possible within the PageTemplate, with the least impact, could be in the StoryColumn, but outside from any tiddlers / list widgets populating the story-river\r\n    1. this would actually decouple the $wiki object from the $popup widget as it can now know and talk to another nothing but widget instance, otherwise output some info that we're missing this crucial spot"},"comment":{"url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/comments/163590021","html_url":"https://github.com/Jermolene/TiddlyWiki5/issues/2120#issuecomment-163590021","issue_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/2120","id":163590021,"user":{"login":"Jermolene","id":174761,"avatar_url":"https://avatars.githubusercontent.com/u/174761?v=3","gravatar_id":"","url":"https://api.github.com/users/Jermolene","html_url":"https://github.com/Jermolene","followers_url":"https://api.github.com/users/Jermolene/followers","following_url":"https://api.github.com/users/Jermolene/following{/other_user}","gists_url":"https://api.github.com/users/Jermolene/gists{/gist_id}","starred_url":"https://api.github.com/users/Jermolene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jermolene/subscriptions","organizations_url":"https://api.github.com/users/Jermolene/orgs","repos_url":"https://api.github.com/users/Jermolene/repos","events_url":"https://api.github.com/users/Jermolene/events{/privacy}","received_events_url":"https://api.github.com/users/Jermolene/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T11:54:42Z","updated_at":"2015-12-10T11:54:42Z","body":"Hi @tobibeer I'll emphasise again: we can't have widgets that have side effects on the DOM outside of their place in the tree. We have to do that via a startup module, as we do with the modal wizard mechanism.\r\n\r\nI think there are a few approaches for exploring your issues:\r\n\r\n* Taking advantage of the fact that the reveal widget picks up the popup coordinates from the state tiddler. Thus it is possible to position a popup arbitrarily\r\n* Taking advantage of the fact that the reveal widget and the button don't need to be adjacent in the DOM\r\n* Enhancing the modal mechanism to allow it to be used in popup-like situations\r\n\r\n"}}