- Issue created by @JamesPosko
- 🇩🇪Germany Anybody Porta Westfalica
Thanks @JamesPosko I can confirm that. Already ran into this myself.
As it's Drupal-specific, we should exclude the selectors in the initialization generally. Could you provide a MR?
- @anybody opened merge request.
- 🇩🇪Germany Anybody Porta Westfalica
Having a short look at the (hidden) fields at
/admin/structure/types/manage/page/form-display
I don't think it's the weight field, because that's (visible and hidden) always a text input. I think it's the parent field at least in that form.Looking at
/admin/structure/menu/manage/main
it's indeed the .menu-weight select.Let's filter out both and try if it works. Could you do that? Additionally a test for all such cases in core wouldn't be bad.
- Status changed to Needs review
over 1 year ago 4:43pm 15 March 2023 - 🇩🇪Germany Anybody Porta Westfalica
Any other selectors to consider?
I also thought about using the
name$=['weight']
(ends with) selector instead, but it's not as performant as class selectors. What do you think? Wow! This is great! Thank you for the quick response.
I was able to clone the repository and test the merge request changes. The merge request works great on the menu table drag elements.
Thinking about your last question, I tested the update with Paragraphs and the table drag elements use a different class on these elements. This produces the same issue as before. So the
name$=['weight']
(ends with) selector might be a better way to catch the various instances of elements with the table drag functionality. Or maybe a way to skip the select elements with a parent that has a class of.tabledrag-hide
.- 🇩🇪Germany Anybody Porta Westfalica
Thank you @JamesPosko! Could you try to change the exclude to
.tabledrag-hide
is not be as good, as it MIGHT be removed if the weight is shown? Or we could combine both.
Could you give it a try perhaps? Or aren't you a developer? - Status changed to Needs work
over 1 year ago 6:35am 16 March 2023 I'll give adjusting the selectors a try locally and update the merge request. Thanks for collaborating on possible solutions.
I went with using
select[data-drupal-selector$="weight"]
because thename
attribute had a few different version of ending with weight with square brackets. The classes on the select element are all different when table drag functionality is added. I attempted to useoffsetParent
but if the element or any ancestor has thedisplay
property set tonone
it will returnnull
.I tested this on Paragraphs, menus, blocks, roles, and views rearrange table drag elements.
- Status changed to RTBC
over 1 year ago 9:47am 17 March 2023 - 🇩🇪Germany Grevil
@JamesPosko great work! Works as expected!
Thanks for the quick implementation and review!
RTBC!
- Status changed to Fixed
over 1 year ago 9:49am 17 March 2023 - 🇩🇪Germany Anybody Porta Westfalica
Thank you all! I now did the same for parent.
- Status changed to Needs work
over 1 year ago 2:26pm 17 March 2023 Thank you @Anybody for the assistance and collaboration on this issue. Thank you @Grevil for reviewing and testing.
- Status changed to Fixed
over 1 year ago 2:28pm 17 March 2023 Automatically closed - issue fixed for 2 weeks with no activity.