Problem/Motivation
When adding a new search page at /admin/config/search/pages, the "Label" field is used to auto-fill the machine name. However, if a user changes the label after the initial autofill, the machine name does not update accordingly. This behavior is inconsistent with other places in the core (e.g., content types, menus), where the machine name updates automatically as long as it has not been manually edited.
Steps to reproduce
- Navigate to /admin/config/search/pages.
- Select a page type (Content, Help, or Users) under "Search page type".
- Observe that the "Label" field is autofilled based on the selected page type and the machine name is generated accordingly.
- Change the "Label" field.
- Notice that the machine name does not update to reflect the new label.
- The only way to update the machine name is to click "Edit" next to the machine name field and manually enter it.
Proposed resolution
Update the behavior to ensure that the machine name field continues to sync with the label field, unless the machine name has been manually edited. This would make the experience consistent with other parts of Drupal core.
Remaining tasks
Identify the form and field components responsible for this behavior.
User interface changes
The machine name field under the search page creation will dynamically update when the label is changed (unless manually edited).
Introduced terminology
None.
API changes
None.
Data model changes
None.
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | After machine name.mp4 | 226.21 KB | sagarmohite0031 |
| #10 | Beforemachine name.mp4 | 394.99 KB | sagarmohite0031 |
Issue fork drupal-3520941
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:
Comments
Comment #3
prashant.cComment #4
smustgrave commentedThanks for reporting, can we add a test case showing the bug
Comment #5
prashant.cAttempted to write the test, needs to be reviewed.
Comment #6
smustgrave commentedSeems to have test failures
Comment #7
prashant.cComment #8
smustgrave commentedInstead of its own file and own test is there not an existing test that could be expanded
Comment #9
prashant.cThe search module does not yet have any functional JavaScript tests. So, this is the only file for it. However, the search module has another test type, functional, kernel, and unit, where this won't fit AFAIK.
Comment #10
sagarmohite0031 commentedHello,
Tested and verified on Drupal 11,
MR applied successfully,
and working as expected "machine name is generated accordingly."
Steps to reproduce-
Navigate to /admin/config/search/pages.
Select a page type (Content, Help, or Users) under "Search page type".
Observe that the "Label" field is autofilled based on the selected page type and the machine name is generated accordingly.
Change the "Label" field.
Notice that the machine name does not update to reflect the new label.
The only way to update the machine name is to click "Edit" next to the machine name field and manually enter it.
Check attachments
RTBC+
Comment #11
sagarmohite0031 commentedComment #12
larowlanThanks for working on this.
The test added doesn't match the steps to reproduce in the issue summary.
The issue summary mentions that you put in an initial value and it works (which is what the test covers) but then that after you change the value it no longer works - this aspect isn't covered in the test that I can see.
Comment #14
quietone commentedThe Search Module was approved for removal in #3476883: [Policy, no patch] Move Search module to contrib .
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3565780: [meta] Tasks to deprecate the Search module and the removal work in #3565783: [meta] Tasks to remove the Search module.
Search will be moved to a contributed project before Drupal 12.0.0 is released.
Comment #15
quietone commentedThe Search Module has moved from core to contrib,