We need to refactor our comments JavaScript
- Wrap it in a Drupal behavior
- Use data attributes as selectors where possible
https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/themes/olive...
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | 3208372-21.patch | 7.53 KB | paulocs |
| #21 | interdiff-20-21.txt | 1.18 KB | paulocs |
| #20 | 3208372-20.patch | 7.87 KB | paulocs |
| #19 | 3208372-19.patch | 7.84 KB | paulocs |
| #19 | interdiff-8-19.txt | 1.73 KB | paulocs |
Comments
Comment #2
mherchelNote that I wasn't able to modify a template to insert a data attribute for the
.indentedselector. This markup is generated within the comment module at https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/modules/comm...This should be good to go!
Comment #3
gauravvvv commentedI have provided the patch please review.
Comment #5
gauravvvv commentedComment #6
mherchelThe interdiff in #4 didn't match the patch. Either way, we don't want to introduce new node dependencies.
The reason #2 failed is because babel (on the D.O servers) didn't understand the optional chaining syntax. I'm removing that in this patch.
Comment #8
mherchelAttaching a new patch that uses the
[data-drupal-selector]pattern.Tugboat preview: https://3208372-refactor-comments-js-py9veecd6lb02zgxukvwkzknubwmvwtv.tu...
Comment #9
andy-blumI don't think we're using the class name 'comments' anywhere. Do we still want/need to attach that class since it's not doing anything?
Besides that, I think we're good
Comment #10
mherchelYeah, I say we should still include it. Eventually the starterkit theme generator will be able to copy this theme, and in that case the class might be useful for people to style against.
Comment #11
thejimbirch commentedIf that is the case, then RTBC.
Comment #12
thejimbirch commentedComment #14
mherchelUnrelated failure.
Comment #16
gauravvvv commentedUnrelated failure.
Comment #17
lauriiiThese should be documented according to the coding standards https://www.drupal.org/docs/develop/standards/javascript/javascript-api-...
Comment #18
paulocsWorking on it.
Comment #19
paulocsAttaching patch and interdiff.
Comment #20
paulocsSorry for the patches. I'm starting now contributing to front-end. I'm having problems with prettier.
Comment #21
paulocsI think now it is right...
Comment #22
marcusvsouza commentedRTBC!
Comment #23
mherchel+1 RTBC
Comment #26
lauriiiNoticed the use of indented class but since it's in a piece of markup that is hard to override, I decided to open issue in the comment module issue queue instead: #3221204: Move markup to templates from CommentViewBuilder.
Committed 630cd36 and pushed to 9.3.x. Also cherry-picked to 9.2.x since Olivero is experimental. Thanks!