Problem/Motivation
Claro theme does not have the right form error class.
The files core/themes/claro/templates/details.html.twig and core/themes/claro/templates/navigation/details--vertical-tabs.html.twig have the class "form-item--error-message" but in the stylesheet core/themes/claro/css/components/form.css is defined "form-item__error-message" so if any error is displayed on the details component it is shown without styles.
Steps to reproduce
- Make claro the default theme, so the test page we visit is rendered by Claro
- Enable the
inline_form_errorsmodule - Enable the
form_testmodule. It is a test module so you'll need$settings['extension_discovery_scan_tests'] = TRUE;in your settings if it isn't already there. - Go to
form_test/details-formand submit the form. There will be an error "I am an error on the details element." that should be styled red but it is not due to the class being incorrect as reported
Proposed resolution
Use the right class.
Test for this by expanding \Drupal\form_test\Form\FormTestDetailsForm to try with Claro in addition to the default test theme, and assert the expected class is present.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 1.jpg | 74.93 KB | skipper-vp |
| #8 | 3298580-8.patch | 1.14 KB | akram khan |
| screenshot_failed_class_claro.jpg | 57.49 KB | eduardo morales alberti |
Issue fork drupal-3298580
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 #2
eduardo morales albertiComment #4
eduardo morales albertiComment #5
Bushra Shaikh commentedComment #6
Bushra Shaikh commentedComment #7
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
MR should be updated for 10.1
Comment #8
akram khanUpdated Patch for drupal 10.1.x
Comment #9
akram khanComment #10
smustgrave commentedThink this could also use a test case showing the issue.
Comment #12
bnjmnmComment #13
skipper-vp commentedI have tried to look into the issue manually but couldn't find the error you're describing.
I can see the error in the message area, but not on the element itself, moreover dumping errors variable from details.twig returns null (see screenshot). Could you give me a hint if I'm missing out on anything?
Comment #14
bnjmnmComment #15
bnjmnmRe #13 enabling the Inline Form Errors module should get this to show up I just updated the issue summary to include this in steps to reproduce.
Comment #18
utkarsh_33 commentedWe are making changes in claro templates only.Do we need to do the same of default theme and then expand tests or shall we create a follow-up issue for default theme?
Comment #19
bnjmnm\Drupal\form_test\Form\FormTestDetailsFormalready tests the default theme. it is simplest to add a few lines to that test to run the test with the default theme and then with Claro. Use a@dataProviderSet up your dataProvider and put this at the beginning of the test to set the theme when
$themeisn't false, and that does everything needed without having to add a new test class that is 99% the same as an existing one.Comment #20
utkarsh_33 commentedComment #22
smustgrave commentedAdded some nitpicky typehints
The failure is unrelated to this change.
Believe this one is good.
Comment #28
nod_Thanks for the fix and thanks for including a test, in this case the fix doesn't warrant a test and I removed it on commit.
Committed and pushed 8f25e5c227 to 11.x and 0c542167d6 to 11.0.x and 0dd26ceb53 to 10.4.x and 4f0a7ce2c8 to 10.3.x. Thanks!
Comment #31
nod_credit to longwave and quietone for helping with testing decision