-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add fomantic-dropdown webcomponent #33723
base: main
Are you sure you want to change the base?
Conversation
Using a vanilla web component add the correct event listener for handling dropdowns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pity to see more jQuery usage, but I know that there is no way around that for now
I see the size of the webpack chunk did not change, which means webpack is not bundling anything extra into that chunk:
So I guess this is more like a convenience-only thing right now. |
What's the long-term plan for the new component? Will it be applied to all other menus? Maybe it's a placeholder for a rewritten, so that we can have a name without related to fomantic-ui. |
@lunny @silverwind Right now this is a small wrapper to ensure event listeners are correctly added. This enabled the use of dropdowns in both vuejs and when dynamically added to pages without manually adding the Longer term I would like to work with you to figure out a roadmap for #29849 which would eventually replace this code. For example I tried out shoelace.style for this and it seems promising but limiting in the ability to style it. |
Sorry, we can't do that. The dropdown is quite special, we already have a complex system to init various dropdowns correctly. This approach
will definitely break. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to call init functions instead of using webcomponent
For example: initCompReactionSelector
and others.
Webcomponent won't help too much for our case. At the moment, the best approach I can think of is: #33498 (comment)
<button data-global-click="show-panel"></button>
<a data-global-click="link-acton"></a>
<div class="dropdown" data-global-init="initMyDropdown"></div>
<div class="editor" data-global-init="initComboMarkdownDropdown"></div>
<input name="avatar" data-global-init="initAvatarUploaderWithCropper">
Then we could resolve many longstanding problems:
- avoid many duplicate "init" calls
- incorrect init & double init (especially when use htmx or partial reloading)
Closes #33532
Using a vanilla web component add the correct event listener for handling dropdowns.
Screen.Recording.2025-02-25.at.1.38.41.PM.mov