silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
721 stars 821 forks source link

W3C compatibility #7438

Open Blueace opened 7 years ago

Blueace commented 7 years ago

Not a big deal, but... Assuming SS is HTML5

1) we get in the header both :

<meta charset="utf-8"> and <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

In HTML5 it's the same and generates a warning, so one is not needed. Best practice said to keep the shorter.

2) We also have in header.ss

<header class="header" role="banner">

Role="Banner" is not needed and generate a warning. Should be deleted.

dhensby commented 7 years ago

This is likely an issue with the simple theme and not the framework itself.

PRs to go against: https://github.com/silverstripe-themes/silverstripe-simple please

Blueace commented 7 years ago

I'm not so sure, because the line <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> comes from the framework I guess (in fact I don't know from where, but it's not in the style).

Also, because so far SS aria codes are not W3C cumpliance, I suggest to delete the following line in framework/forms/FormField.php : $attributes['aria-required'] = 'true'; Because it's generating an error, not just a warning, for all the SS forms.

chillu commented 7 years ago

Also, because so far SS aria codes are not W3C cumpliance, I suggest to delete the following line in framework/forms/FormField.php

What generates an error? Can you show it here, alongside with a full copy of the HTML document that generated the error?

lerni commented 10 months ago

Can <meta charset="utf-8"> be used in all instances for v6? It's a HTML4 vs. 5 thing; in v6 HTML5 should be default? I cannot reproduce the aria-required validation problem, therefore I suggest to target this for v6 or close. Meanwhile it can be achieved with an extension like below.

See also: https://blog.whatwg.org/the-road-to-html-5-character-encoding


namespace App\Extensions;

use SilverStripe\Core\Extension;
use SilverStripe\Control\ContentNegotiator;

class PageExtension extends Extension
{
    public function MetaComponents(array &$tags)
    {
        $charset = ContentNegotiator::config()->uninherited('encoding');
        $tags['contentType'] = [
            'attributes' => [
                'charset' => $charset
            ]
        ];
    }
}