Problem/Motivation
In the SEO widget, the SEO title and SEO description fields become visible only when Enable title editing and Enable description editing are disabled in:
/admin/structure/types/manage/{content-type}/form-display
However, the fields cannot be edited. Clicking them does nothing — they do not receive focus and do not allow text input.

When the editing options are enabled, the fields do not appear at all, but the core problem is that the fields are never editable even when they are displayed.

This makes it impossible to modify the SEO title and SEO description through the content form.
And I'm getting this error in console:
An error occurred during the execution of the Ajax response: TypeError: snippetTitle.attr is not a function
(anonymous) @ ajax.js?v=11.2.8:1145
Promise.catch
Drupal.Ajax.success @ ajax.js?v=11.2.8:1143
success @ ajax.js?v=11.2.8:586
options.success @ jquery.form.js?v=4.3.0:281
c @ jquery.min.js?v=4.0.0-rc.1:2
fireWith @ jquery.min.js?v=4.0.0-rc.1:2
E @ jquery.min.js?v=4.0.0-rc.1:2
(anonymous) @ jquery.min.js?v=4.0.0-rc.1:2
XMLHttpRequest.send
send @ jquery.min.js?v=4.0.0-rc.1:2
ajax @ jquery.min.js?v=4.0.0-rc.1:2
$.fn.ajaxSubmit @ jquery.form.js?v=4.3.0:340
Drupal.Ajax.eventResponse @ ajax.js?v=11.2.8:798
(anonymous) @ ajax.js?v=11.2.8:648
dispatch @ jquery.min.js?v=4.0.0-rc.1:2
v.handle @ jquery.min.js?v=4.0.0-rc.1:2Steps to reproduce
- Install and enable the yoast_seo module.
- Go to:
/admin/structure/types/manage/{content-type}/form-display - Enable:
Enable title editing
Enable description editing - Edit or create content for that content type.
- Observe that the SEO title and SEO description fields are NOT shown, you can't click them and editing is not possible.
Proposed resolution
Fix the initialization of the editable fields in js/yoast_seo.js.
The current code uses .attr(), which is a jQuery-only method.
The script does not use jQuery, so the call silently fails and contenteditable is never applied.
Replacing .attr() with the native DOM method setAttribute() solves the issue:
- snippetTitle.attr('contenteditable', 'true');
+ snippetTitle.setAttribute('contenteditable', 'true');
- snippetMeta.attr('contenteditable', 'true');
+ snippetMeta.setAttribute('contenteditable', 'true');
After this change, both fields correctly become editable when editing is enabled in the form display.
Here is patch for this.
Remaining tasks
Review and merge the patch.
Test on a clean Drupal installation with Yoast SEO only.
Confirm that no regressions occur in other parts of the widget.
Optionally add a simple test to verify the contenteditable attribute is correctly applied.
User interface changes
No visual UI changes.
The only functional difference is that the SEO title and SEO description fields become properly editable when editing is enabled.
API changes
No API changes.
Only internal JavaScript behavior is corrected.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3560779-5.patch | 732 bytes | borisr |
| yoast_seo-fix-attr-method.patch | 820 bytes | drale01 | |
| disabled.png | 330.73 KB | drale01 | |
| enabled.png | 242.78 KB | drale01 |
Issue fork yoast_seo-3560779
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3560779-cannot-edit-seo
compare
- 8.x-2.x
compare
- revert-411990d2
compare
Comments
Comment #2
netgeek123 commentedHaving the same issue. The "patch" isn't working.
Where the edit fields for title and description now show:
When i disable editing of the title and description, the fields show as normal, just can't edit then as expected when disabled.
I applied the patch and it made no difference.
I am getting console error:
Comment #3
drale01 commentedI tested the patch again, and I can confirm it works correctly when applied locally. I downloaded the patch file from drupal.org and saved it to a local patches/ directory, then configured it in
composer.jsonto use the local file path instead of the remote URL.When I tried using the patch directly from the drupal.org URL, it didn't work (the URL returned a 404 error). However, when I applied the same patch file locally, it worked perfectly without any errors.
Here's what I did:
patches/yoast_seo-fix-attr-method.patchcomposer.jsonto reference the local patch file:The patch applied successfully and the SEO title and description fields are now editable as expected. The issue seems to be with accessing the patch file directly from the drupal.org URL, but using a local copy works fine.
Comment #4
stsharp commentedWe are having this problem as well. We are running Drupal 11.3.2. I would like to note we were testing this module back in July and it worked fine. We didn't work on it for a few months and i started testing it again in late November and this is when I first noticed this problem. Has anyone gotten this patch to work on this version of Drupal?
Comment #7
borisr commentedI ran into the same issue as well. I tried applying the patch, but I hit the same problem as drale01. Instead, I applied the changes manually (and can confirm they work) and generated a new patch.
Note: I also created an issue fork, but I accidentally pushed the changes directly to the default 8.x-2.x branch. It looks like I can’t revert that now. The 3560779-cannot-edit-seo branch contains the correct updates (the same changes as in the patch).
Comment #8
drale01 commentedI can confirm that patch works correct locally on Drupal 11.3.2.
Comment #9
anruetherPatch in #7 fixes also #3537343: Javascript error for me.