Review main Merged

62169[BUGFIX] Add lang attribute to html tag in Backend

Georg Ringer CR +2 V +2 Easy +3 −1 updated 11/05/19, 08:39

Commit message

The current language of the TYPO3 Backend user is now added as
attribute 'lang' to the html tag of any module using the ModuleTemplate.

This improves accessibility, as it is used by screen readers that switch
language profiles to provide the correct accent and pronunciation.

In addition, DocumentTemplate behaves the same by adding
proper htmlspecialchars()

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Oli Bartsch +1
    • Michael Telgkamp +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Oli Bartsch +1
    • Michael Telgkamp +1
    • Benni Mack +1
    • TYPO3com +1 CI

Issues 1

Files 2

Review log 2836

Show 811 earlier messages
  1. Georg Ringer uploaded patch set 1 10/31/19, 11:17

  2. Georg Ringer commented on patch set 1 10/31/19, 11:18

    This change is ready for review.
  3. TYPO3com voted on patch set 1 V -1 10/31/19, 11:30 Completed build in 12m 21s on Thu, 31 Oct, 11:30 AM Test Summary: 1 of 48438 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37896

  4. TYPO3com voted on patch set 1 V +1 10/31/19, 12:05 Completed build in 59m 47s on Thu, 31 Oct, 12:05 PM Test Summary: 48079 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37896

  5. TYPO3com commented on patch set 1 10/31/19, 12:12 Completed build in 09m 30s on Thu, 31 Oct, 12:12 PM Test Summary: 48079 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37897

  6. Michael Telgkamp commented on patch set 1 10/31/19, 12:29

    PageRenderer.php:744

    As $this->htmlTag might have been changed by $this->setHtmlTag maybe a check if $this->htmlTag already contains a lang attribute should be added?
  7. Markus Klein commented on patch set 1 CR +1 10/31/19, 14:00

    PageRenderer.php:744 Reply

    I guess in BE-context it is every unlikely that it got set already, isn't it?
  8. Markus Klein commented on patch set 1 10/31/19, 14:00

    PageRenderer.php:2653

    maybe make it private?
  9. Michael Telgkamp commented on patch set 1 10/31/19, 14:15

    PageRenderer.php:744 Reply

    I did a clean setup without this change and had a lang attribute in the <html> tag so there is most likely another place where that is added.
  10. Oli Bartsch commented on patch set 1 10/31/19, 15:30

    PageRenderer.php:744 Reply

    AFAICS this is just the default which gets assigned in TYPO3\CMS\Backend\TemplateDocumentTemplate:417
  11. Georg Ringer commented on patch set 1 10/31/19, 19:27

    PageRenderer.php:744 Reply Unresolved

    @michael: are you sure that it is in the source of site and not the dom, e.g. added by a e.g. browser plugin? can't reproduce that

    PageRenderer.php:2653 Reply Unresolved

    we don't do that through the core, so would keep it that way
  1. Oli Bartsch commented on patch set 1 11/01/19, 12:02

    Hi Georg, I tried to test this patch but AFAICS the `getHtmlTag()` function you adjusted is not used anywhere. The `htmlTag` gets assigned as Marker to the template by using the variable directly without the getter. E.g. in TYPO3\CMS\Core\Page\PageRenderer:1811. Furthermore also without this patch, if I change the be users lang the `lang` attribute is rendered in the `html` tag with the correct two-letter code. Maybe I overlook something. So could you please give me some information about how this patch changes the current behaviour and more important how to test this. Thank you.
  2. Georg Ringer uploaded patch set 2 11/01/19, 19:01

  3. TYPO3com voted on patch set 2 V +1 11/01/19, 19:11 Completed build in 10m 20s on Fri, 1 Nov, 07:11 PM Test Summary: 48091 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37917

  4. Oli Bartsch commented on patch set 2 CR -1 11/01/19, 20:41

    PageRenderer.php:745 Unresolved

    Are we sure 'lang' is always present? I would suggest using null coalesce anyway just to be on the safe side.

    PageRendererTest.php:360 Unresolved

    I think this should be removed.
  5. Benni Mack commented on patch set 2 V -1 CR -1 11/02/19, 09:01

    -1 on various things: a) What's the actual motivation / improvement / benefit of this change? What would you want to achieve (and where)? Please clarify in the commit message, or a Feature or Important.rst. b) PageRenderer is used in BE and FE. I guess (and that's why both ticket and review are not really an improvement on helping why something is done) that all HTML documents in the backend should add a "lang" attribute. So, adding a dependency of BE_USER to PageRenderer is the wrong way, as it leads to ugly side effects on various places. As you might have seen, DocumentTemplate uses setHtmlTag() already to set the language attribute, and I would say that this is the correct way, but you also want this to happen in ModuleTemplate? c) Unfortunately, the BE_USER->uc[lang] value does NOT contain the requested ISO code, but rather the typo3Language ("default" instead of "en"), which could be very arbitrary. So I suggest we should first sort out the language mismatches (see Locales.php) and migrate away from this specific code stuff towards ISO 369-1 or ISO 369-2. (separate change, part of a bigger task force I'd say).
  6. Markus Klein commented on patch set 2 11/03/19, 10:38

    @Benni: I can clarify the first point. The language needs to be present for inline translations of crowdin to work.
  7. Benni Mack uploaded patch set 3 11/03/19, 19:49

  8. TYPO3com voted on patch set 3 V -1 11/03/19, 19:59 Completed build in 10m 44s on Sun, 3 Nov, 07:59 PM Test Summary: 47791 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37947

  9. Georg Ringer commented on patch set 3 11/04/19, 07:36

    it is not about crowdin but about accesibility
  10. Benni Mack updated the commit message in patch set 4 11/04/19, 07:39

  11. TYPO3com voted on patch set 4 V -1 11/04/19, 07:48 Completed build in 09m 02s on Mon, 4 Nov, 07:48 AM Test Summary: 1 of 48438 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37952

  12. TYPO3com voted on patch set 4 V +1 11/04/19, 07:52 Completed build in 22m 28s on Mon, 4 Nov, 07:52 AM Test Summary: 48079 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37952

  13. Markus Klein voted on patch set 4 CR +1 11/04/19, 07:52

  14. Oli Bartsch commented on patch set 4 11/04/19, 08:56

    ModuleTemplate.php:338

    Maybe we could move this in a separate function to: 1. Don't brake the "assignment flow" (setter - setter - setter - variable declaration - setter) 2. Reuse this somehow / sometimes
  15. Benni Mack commented on patch set 4 CR +1 11/04/19, 09:16

    > Patch Set 3: > > it is not about crowdin but about accesibility OK. then what i

    ModuleTemplate.php:338 Reply

    well, I'd say that the whole "initializePageRenderer" functionality is one big "flow", for now this seems OK to me. In general, the ModuleTemplate / DocumentTemplate logic and API is not really properly decoupled (PageRenderer itself is a huge mess). We could start (separately from this change) to split up PageRenderer, using proper defined models (e.g. factories for setting up PageRenderer - different for BE and FE). What do you think?
  16. Benni Mack commented on patch set 4 11/04/19, 09:17

    > Patch Set 4: Code-Review+1 > > (1 comment) > > > Patch Set 3: > > > > it is not about crowdin but about accesibility > > OK. then what i sry for this comment. Already updated the commit message.
  17. Oli Bartsch commented on patch set 4 CR +1 11/04/19, 09:39

    ModuleTemplate.php:338 Reply Unresolved

    All right, I'm fine with this. I agree on the current state, that's why the refactoring / decoupling part sound to be really necessary.
  18. Benni Mack uploaded patch set 5 11/04/19, 10:36

  19. Georg Ringer voted on patch set 5 V +1 CR +1 11/04/19, 10:37

  20. TYPO3com voted on patch set 5 V +1 11/04/19, 10:57 Completed build in 18m 37s on Mon, 4 Nov, 10:57 AM Test Summary: 48079 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37966

  21. Benni Mack voted on patch set 5 V +1 11/04/19, 13:00

  22. Michael Telgkamp voted on patch set 5 V +1 CR +1 11/04/19, 13:45

  23. Oli Bartsch voted on patch set 5 V +1 CR +1 11/04/19, 14:18

  24. Georg Ringer voted on patch set 5 V +2 CR +2 11/05/19, 08:39

  25. Georg Ringer merged patch set 6 11/05/19, 08:39