Skip to content
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 support of form attribute for detached input #1253

Merged
merged 1 commit into from
Nov 18, 2022
Merged

Conversation

herrvigg
Copy link
Collaborator

@herrvigg herrvigg commented Nov 18, 2022

Input elements are usually created below a form to be submitted. There's another alternative with the form attribute that allows them to be placed anywhere in the document.

This field was ignored by qTranslate, assuming all inputs below a form. This problem was first seen with ACF6 field group title (#1252).
This patch considers this attribute before creating new elements. It is read in priority, before looking for the closest form.

@herrvigg herrvigg added the core Core functionalities, including the admin section label Nov 18, 2022
Input elements are usually created below a form to be submitted.
There's another alternative with the `form` attribute that allows
them to be placed anywhere in the document.

This field was ignored by qTranslate, assuming all inputs below a form.
This problem was first seen with ACF6 field group title (#1252).
This patch considers this attribute before creating new elements.
It is read in priority, before looking for the closest form.
@herrvigg herrvigg merged commit 781a282 into master Nov 18, 2022
@herrvigg herrvigg deleted the fix-detached-input branch November 18, 2022 22:26
herrvigg added a commit that referenced this pull request Nov 19, 2022
Though the `form` attribute is quite unusal, it becomes harder to
find the hidden elements if those are created under the form.
Better keep them together with the detached input field.

The `qtranslate-edit-language` is an exception as it's unique for
the whole form and not linked to other elements.

Simplify the code by re-using `qtranxf_ce`. Extend it by sending
the `beforeNode` instead of a boolean handling only the firstNode.
@herrvigg herrvigg restored the fix-detached-input branch November 19, 2022 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core functionalities, including the admin section
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant