-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search dropdown doesn't display when create wikitext link was recently used #3484
Comments
Looking at the code, I think what's happening is that the |
I suspect the wikitext link button doesn't delete or reset the dropdown state tiddler properly. |
Hi @hoelzro , @twMat ... the bug here is that the popup gets cancelled clicking on the page, but not when clicking within input fields. I solved that "my way" in the keeboord plugin at https://burningtreec.github.io/KeeBoord (in development) / http://keeboord.tiddlyspot.com (stable) |
@twMat You're right - it doesn't delete the dropdown state, because @BurningTreeC Is that with all input fields, or just with input fields with |
Addresses GH TiddlyWiki#3484 As far as I can tell, the popup level checks in this module are meant to handle nested popups. It seems to me that the goal is for at most a single hierarchy of popups to exist at any given time - bearing that in mind, this change checks any popups currently tracked by the module, canceling any that don't share an element hierarchy with the new popup.
I wrote up a change to fix this in #3490; I don't know if this is how @Jermolene would like it done, but I'm going to experiment with my change over the next few days and make sure it doesn't break other things. |
with all input fields. before triggering a popup, my solution cancels all. I do it in core/modules/editor/engines/framed.js and core/modules/editor/engines/simple.js in the corresponding your solution I guess wouldn't handle the tags-dropdown when clicking within the text editor, right? |
Correct - my solution doesn't handle that. |
@BurningTreeC I'd welcome integrating our solutions, as long as @Jermolene thinks they both merit inclusion! |
Hi @hoelzro thanks for the very clear bug report, and thanks @BurningTreeC and @twMat too. It'd be great if you could put your heads together on this. |
Currently, without further modifications, popups get cancelled when clicking on the page, but not when clicking within There already is a listener for clicks on the page, which cancels popups when clicking. My approach then inserts in the Input fields can have popups that open when they get focus and focus can set not just by clicking, also using |
@hoelzro I've played with your PR and I think your approach is good! I'd like to consider two things:
|
With regards to moving the logic I wrote into its own function - definitely! With regards to the DOM node option, I'm not sure if I understand you entirely. I'm thinking what you want can be done by just passing a different DOM node to the function I'll be creating to encapsulate the logic I wrote, but maybe not. In your example, you mention that closing the editor toolbar popups should not be closed by clicking on the editor; what are some examples of popups that should be closed, in your opinion? |
In my opinion, clicking the editor (and any other input field, too) should behave like clicking anywhere else on the page, thus, close all popups. My idea was to eventually be able to keep the toolbar popups by passing the node that contains the toolbar to your function and add a test if the popup is contained within that node and don't cancel it if so. But that's probably something I should add on my own in a plugin, so we can let that aside. The more interesting question is if we call your function from |
we also need a check if the input or textarea is contained within the popup, and don't cancel it in that case neither |
Ok, I see - one roadblock, then, is things currently using Here's how I'm thinking the popup behavior should be specified:
Sorry for the verbosity and redundance - I have a nine week old daughter at home, so focus and concentration are lacking these days! Please let me know if you think these rules need adjusting. |
Congratulations @hoelzro! Now's the time to start on that TiddlyWiki-fied multimedia baby progress record... Going back the popup manager, I think there may well be some fundamental design flaws in there. It was implemented very early, before TW5 had a lot of the expressiveness it has today, and before I'd got my present understanding of the design issues involved in balancing state between the DOM and the tiddler store. Soooo, I suspect that this might be one of those situations where the choice is between:
And of course it might make sense to do both.... |
Congratulations also from me @hoelzro ... ! No problem, we continue the discussion here, no need to feel forced to join in @Jermolene the question that stops this here is if inputs and textareas should cancel popups when they get focus (and not just when they are clicked) or not. @hoelzro's solution will cancel popups when an input gets focus that has a dropdown itself. Inputs without dropdowns won't cancel popups neither by clicking or focussing them by If we have an answer to this question I think we can start figuring out where to change or add something I believe inputs and textareas (Editor included) should always cancel popups if they get focus. |
[Off topic]
@Jermolene ...are you teasing us? ;-) Please speak up about intentions/plans/thoughts - otherwise who could possibly spend time on popup mechanisms that might possibly, if at all, be used in something a decade or two from now? |
Hi @twMat here I was just talking about the popup mechanism, and pointing out that we might end up wanting to improve it in ways that would break backwards compatibility (maintaining the precise semantics of all the magic CSS classes is a burden), and suggesting strategies for dealing with it if we do. |
Thanks everyone! I agree with @BurningTreeC in that inputs getting focus (via click or keyboard tabbing) should cancel popups, with the exceptions I mentioned above. I'm not sure what the right design for the editor toolbar is; an alternative would be to have the editor associated with the toolbar popups as a handle (like the search input is a handle), but maybe that's anchoring the idea too much to the existing design. I think that it might make sense to revisit the popup mechanism's underlying design - I'm hoping we don't need to break backwards compatability too much! @Jermolene what are some of the other design issues that you can think of with the popup code? I'm thinking we might be able to get away with some smaller tweaks around |
Cancelling popups when focusing inputs that don't have a dropdown sounds reasonable, but I think would require us to introduce a new magic class to convey whether there is a dropdown, hence my comments about backwards compatibility.
I was particularly thinking of the burden of maintaining the same semantics for the magic CSS classes that we use. The JS code is brittle and hard to modify so I wouldn't be surprised if some refactoring was needed to keep things comprehensible. |
Understood - regarding the "input focus popup cancelation" problem, what do you think about having a data attribute on an input element, rather than <$edit-text class="tc-popup-handle" /> ...with something like this: <$edit-text data-popup=<<popupState>> /> |
Thinking about this some more - I wonder how much |
A brief search of the code reveals that |
Sorry for the lack of movement on this - I'm going to start looking at this again. I'm thinking that a good way forward might be to remove
After this, we can add some code to make sure that changes in focus also trigger popup hiding, as @BurningTreeC mentioned. |
Addresses GH #3484 As far as I can tell, the popup level checks in this module are meant to handle nested popups. It seems to me that the goal is for at most a single hierarchy of popups to exist at any given time - bearing that in mind, this change checks any popups currently tracked by the module, canceling any that don't share an element hierarchy with the new popup.
Addresses GH TiddlyWiki#3484 As far as I can tell, the popup level checks in this module are meant to handle nested popups. It seems to me that the goal is for at most a single hierarchy of popups to exist at any given time - bearing that in mind, this change checks any popups currently tracked by the module, canceling any that don't share an element hierarchy with the new popup.
@hoelzro, is this still an issue in the current prerelease? |
1 similar comment
@hoelzro, is this still an issue in the current prerelease? |
@BurningTreeC This seems to be working now, thanks for following up! |
@hoelzro @Jermolene so this issue can be closed |
Steps to reproduce:
tag
)full
)I've managed to reproduce this on Firefox (62.0.3) and Chromium (69.0.3497.100-1)
Here's a GIF demoing the bug:
I think I've seen something similar with the tag dropdown, but I haven't taken the time to reduce that to a series of reproducible steps.
The text was updated successfully, but these errors were encountered: