For multi-lingual sites search results can present results from languages other than the defined language of the page.
Any time the language switches within a page screen readers need to be notified so that they can read aloud with the correct language library.
This is simply a matter of appending lang="en" or lang="fr" to the article/section that holds the title/teaser.
https://www.w3.org/TR/UNDERSTANDING-WCAG20/meaning-other-lang-id.html
| Comment | File | Size | Author |
|---|---|---|---|
| #44 | interdiff_2992894_36-44.txt | 894 bytes | adalbertov |
| #44 | 2992894_44.patch | 2.78 KB | adalbertov |
| #36 | interdiff-2992894-32-36.txt | 8.06 KB | mohit_aghera |
| #36 | 2992894_36.patch | 2.78 KB | mohit_aghera |
| #32 | interdiff-2992894-29-32.txt | 988 bytes | mohit_aghera |
Comments
Comment #3
mgiffordlang=”{{ langcode }}” in the HTML search result snippet (search-result.html.twig)
I think this is really a rough version of what is needed here. Not very elegant as there are 3 different fragments. Thought about wrapping it in a div, but.... We have too many of those.
This would all need to be applied to the other Core search-result.html.twig files.
Comment #4
mgiffordComment #5
mgiffordComment #8
kristen polThanks for the issue and patch. The patch still applies to 9.1.x.
It looks like the quotes (
”) are not correct and need to be updated so moving back to needs work.Comment #9
adityasingh commentedworking on this.
Comment #10
adityasingh commentedAddressed #8 please review.
Comment #11
kristen polThanks for the update.
1) Patch applies cleanly.
2) Tests pass.
3) New patch addresses the quote issues from #8.
4) Unlikely tests need to be added.
5) Not sure this can be manually tested since this is stable.
6) Also, I am wondering if this change would even be allowed. Normally stable can't be changed.
7) These are all the
search-result.html.twigfiles. None of the other twig files havelangadded. Seems like it should be except for probablystable9. It would be good to get direction from @mgifford on this.Comment #12
mgiffordThanks @Kristen Pol - there is no reason (from an accessibility point of view), not to apply it to all of the search-result.html.twig templates.
I don't think that there were any issues with the release schedule either. I think in this case, it was probably just me rushing to report a problem and not digging for the other templates that would also need to be adjusted.
Thanks for pulling them out. Can someone re-roll a new patch?
Comment #13
andrewmacpherson commentedRe. #11.7 - This change should go into all of the
search-result.html.twigcopies, including stable and stable9.This sort of change is permitted in the stable themes. It's machine-readable accessibility metadata, and mostly non-disruptive as it doesn't affect the element names or nesting. There may be some custom themes with
[lang]attribute selectors in their CSS, but if they are styling things according to language then they likely want to target the search results anyway. We'll need a change record to notify theme and distro maintainers, and advise them to follow suit.Comment #14
kristen polThanks to you both for the feedback. Back to needs work to fix all the files.
Comment #15
adityasingh commentedWorking on this.
Comment #16
adityasingh commentedFixed all the files mentioned in #11.7. Please review.
Comment #18
raman.b commentedResolving the failed test cases from #16
Comment #19
nishantghetiya commented#18 LGTM and Applied successfully.
Comment #21
raman.b commentedUnrelated test failure. Moving back to Needs review
Comment #23
mgiffordLinking open issues from the CivicActions Accessibility - VPAT.
Comment #24
penyaskitoI think we should also modify olivero templates. So far looks good to me.
Comment #25
vsujeetkumar commentedPatch created with the changes mentioned in #24, Please have a look.
Comment #26
kristen polThanks for the update. Based on the following and the previous couple comments, marking this RTBC.
1) Patch still applies cleanly.
2) Tests passed.
3) These are all the search-result.html.twig files:
These are the files changed by patch which cover all of the files above for all themes:
ConfirmClassyCopiesTestchange is modifying the hash for thesearch-result.html.twigfile. I didn't find any other place using a hash like this.4) All changes besides for
oliveroare forh3(title) andp(snippet and info).oliverousesdivinstead ofpand doesn't have{{ info }}in the file for some reason.Comment #27
alexpottWe should have test coverage. Also we need to work out why the code in template_preprocess_search_result()
is not working for us.
Plus that code implies that we should only have a lang attribute when it doesn't match the page. @catch said:
so maybe this should always be there but I do think that we need to fix the preprocess so it works how we want it to work.
Comment #28
alexpottAh...
$result['language']does not exist! It's$result['langcode']...Comment #29
catchAlso - why can't lang be included in title_attributes - it's just an attribute. If so, we wouldn't need all the template changes here at all.
Comment #30
mohit_aghera commented@catch
By adding langcode directly into
title_attributesdoes the trick.Apart from that we need to add
langcodevariable soinline_templatecan use it.I've updated the patch accordingly and added a few test cases as well.
Comment #32
mohit_aghera commentedFixing test cases and updating md5 hash.
Tests are passing on local:
Comment #33
alexpottDue to reverting all the changes to the templates this is no longer necessary.
Are we sure that the info is in the language of the node?
I'm not sure it is. At least
$info['date'] = \Drupal::service('date.formatter')->format($result['date'], 'short');is in the language of the page. And the only implementation in core - comment_node_search_result() - that adds extra info is in the page language and not the node language.I think all these changes should be reverted.
These asserts are asserting on the whole page. I think we should make them only check html inside the search result.
Comment #34
mohit_aghera commented@alexpott
I cross-checked about the "result__info" attributes. They aren't translatable.
So we can remove those changes.
I'll update the patch and remove un-necessary changes.
Comment #35
mohit_aghera commentedComment #36
mohit_aghera commentedUpdating patch with the suggestions from #33
Comment #37
adalbertov commentedHello, I have reviewed patch #36. The un-necessary changes pointed by #33 where removed from the patch and the tests asserts where fixed. Since the search worked perfectly with my manual tests and the code seems fine for me, I'm moving the issue to RTBC.
Comment #38
renatog commented// Visit the search form in spanish language.We need to include Spanish with using Capital letter
https://www.ef.com/wwen/english-resources/english-grammar/capitalisation...
Suggestion:
// Visit the search form in the Spanish language.Comment #39
renatog commented;
Comment #40
renatog commentedComment #41
mohit_aghera commentedComment #42
adalbertov commentedThanks for pointing out the capitalization! I'm lost with the patchs now(sorry for the question, still new to the Drupal), are we considering patch #36, or should we made a new patch with the grammar fix? I'm asking this because patch #39 was deleted.
Comment #43
renatog commentedYeah, please disconsider my patch #38. It was a mistake
So yeap, are we considering the patch #36
My only consideration is to update this patch with this grammar fix on the comment. My suggestion on patch 36 is to change this line:
// Visit the search form in spanish language.to
// Visit the search form in the Spanish language.For this reason updating as "Needs Work"
Comment #44
adalbertov commentedOk, I took the liberty to make the grammar change in the following patch.
Comment #45
renatog commentedIt works
Comment #46
alexpottCommitted and pushed bd882e9b7b to 9.2.x and cdf61eea8d to 9.1.x. Thanks!