- ๐ฌ๐งUnited Kingdom catch
Do we need a new dedicated issue for removing jQuery.form usage from views_ui and views AJAX? That still seems like the next step here afaict.
- ๐บ๐ธUnited States effulgentsia
It wouldn't be a straightforward 1:1 port, but something that might be worth considering is replacing Drupal's whole AJAX system with https://htmx.org/. I think htmx would give us most/all of the features we're used to with Drupal's AJAX, but figuring out the right amount of backwards compatibility wrappers to add would be the tricky part.
- ๐บ๐ธUnited States xjm
JQuery Form does not seem to be maintained anymore, so bumping priority.
- ๐ฌ๐งUnited Kingdom catch
I think we probably still need a dedicated issue for getting rid of jquery.form in views_ui/views_ajax per #19.
- ๐บ๐ธUnited States effulgentsia
Re #23, I don't think Views / Views UI actually use jQuery Form directly, then only use it via Drupal.ajax. I think the only reason they declare a dependency on the plugin is because they instantiate Drupal.ajax() objects from JS code rather than always going through PHP's #ajax, so they don't get the dependency brought in automatically.
In other words, to remove it from Views / Views UI, we need to remove it from misc/ajax.js first. Changing this issue's title and summary to focus on that.
- Status changed to Needs review
about 1 year ago 1:23am 23 November 2023 - ๐บ๐ธUnited States effulgentsia
I haven't tested this at all, so this might fail hard, but something along these lines is what I recommend.
- last update
about 1 year ago Patch Failed to Apply - Status changed to Needs work
about 1 year ago 4:02pm 23 November 2023 - ๐บ๐ธUnited States smustgrave
Seems to have CC failure, could we switch to an MR? Hiding older patches for clarity.
- last update
about 1 year ago Composer error. Unable to continue. - last update
about 1 year ago Build Successful - ๐ฎ๐ณIndia Nitin shrivastava
Nitin shrivastava โ made their first commit to this issueโs fork.
- Merge request !5528Remove jQuery Form dependency from misc/ajax.js โ (Open) created by Nitin shrivastava
- ๐ท๐ธSerbia finnsky
Also seems
$.fieldValue(this.element);
is used from jquery form plugin - ๐บ๐ธUnited States effulgentsia
Re #20, since converting to HTMX is too large scope for this issue, I opened ๐ฑ [Plan] Gradually replace Drupal's AJAX system with HTMX Active as a separate Ideas issue.
- First commit to issue fork.
- ๐ฌ๐งUnited Kingdom catch
This is effectively blocking jQuery 4 now unless we figure out a shim. ๐ [jQuery 4] jquery-form is unmaintained and not jQuery 4 compatible, fork it into core Fixed
- ๐ฌ๐งUnited Kingdom catch
Hid one branch, rebased the other one, fixed one js linting issue so that tests will run.
- ๐ฌ๐งUnited Kingdom catch
Manually tested.
First I uninstall big_pipe because that depends on the AJAX system and was throwing its own errors, just to reduce variables, we probably need to update some things there though.
Without big_pipe, if I change the allowed values on a field form (i.e. /admin/structure/types/manage/article/fields/node.article.body), I get:
An error occurred while attempting to process /admin/structure/types/manage/article/fields/node.article.body?_wrapper_format=drupal_ajax: Illegal invocation
So that seems like somewhere to start.
This unfortunately does not show up in the javascript test error log, we just get unexpected dialog or similar.
- ๐ฌ๐งUnited Kingdom catch
Made a commit which at least gets past the illegal invocation error - needs someone who knows what they're doing to fix it properly.
Next up is
$.fieldValue is not a function
. - ๐ญ๐บHungary Gรกbor Hojtsy Hungary
Added the situation with jQuery 4 into the issue summary's top.
- ๐ฌ๐งUnited Kingdom catch
I messed up the commit history here when I slightly changed the approach. We now have two branches:
1. https://git.drupalcode.org/project/drupal/-/merge_requests/6486 - this is the original approach forking/reimplementing everything we need* from jquery form.
2. https://git.drupalcode.org/project/drupal/-/merge_requests/6486#note_263745 a hybrid approach which leaves the jquery methods in their own fork.
I think I have discovered the cause of most of the test failures remaining in #1, and it's not good news. The original draft here didn't reimplement the ajaxSubmit function. Because of the way ajax.js checks for this, if it's missing, it just skips it, and then AJAX form submits fail with neither console nor PHP errors.
The ajaxSubmit method is massive, so if we copy that to ajax.js, even if we can refactor it a bit, then what we've really done is forked jquery form again into our code base.
I therefore am thinking, at least to get us onto jQuery 4, we should just fork jQuery form and fix the four jQuery 4 issues in it, which is what ๐ [jQuery 4] jquery-form is unmaintained and not jQuery 4 compatible, fork it into core Fixed does. That absolutely does not preclude continuing here, but we might end up making the decision to jump straight to HTMX too.
- ๐บ๐ธUnited States effulgentsia
The ajaxSubmit method is massive
But with modern browsers we shouldn't need 95% of it. The submitForm() function in #26 conceptually should be a drop-in replacement for ajaxSubmit(). It didn't seem to work and I haven't had time to look into it further yet but my hunch is that we shouldn't need to add all that much more code into it to make it work.
I therefore am thinking, at least to get us onto jQuery 4, we should just fork jQuery form and fix the four jQuery 4 issues in it
Yes, I agree with doing that so as not to block our jQuery 4 upgrade on this issue.
- ๐บ๐ธUnited States xjm
Per @longwave, ๐ [jQuery 4] jquery-form is unmaintained and not jQuery 4 compatible, fork it into core Fixed has removed this from the critical path, so downgrading to major.
- ๐ฌ๐งUnited Kingdom longwave UK
Yeah this is no longer strictly necessary for 11.0.0 as per #43 we can ideally refactor it away given there is apparently a lot of cruft that supports old browsers nowadays.
- ๐บ๐ธUnited States xjm
@longwave, @catch and I discussed the priority of this issue a bit, and while it's not in the critical path for D11, it could be considered critical to complete for D12, and this and other open issues should be reparented to the D12 meta when we file it shortly.