Add GUI to configure the site's logo alt attribute

Created on 7 August 2016, over 8 years ago
Updated 26 May 2023, over 1 year ago

Problem/Motivation

When I add logo img to sites I don't get a ALT && Title field as I would get when adding an image_field to nodes.

Proposed resolution

Thus, it seems there is no simple GUI way to add these; By now I myself added them through the twig, but I humbly suggest adding these fields as ensuring valid usage of Drupal for all users. Also, they're quite important for SEO.

Sending people to add these from at the SQL or by an external module should be avoided, I think.

Remaining tasks

The tests that were added need reviewing by someone experienced with tests.

We still need to decide whether we should reference the newly created variables in the twig templates or just stick with the markup defined in variables content ie:

Option 1 (current patch):

$variables['site_logo_alt'] = $variables['content']['site_logo_alt']['#markup'];
$variables['site_logo_title'] = $variables['content']['site_logo_title']['#markup'];

Versus Option 2 (proposed in #23, saying we should maybe not create new variables, and just reference the markup from the existing $variables['content'])

$variables['content']['site_logo_alt']['#markup'];
$variables['content']['site_logo_title']['#markup'];

In #30 it's suggested that using option 1 is okay. Option 1 makes it so we lose the #access part of the render array. If you look at other variables like 'site_name', and 'site_slogan', they do not have the #access part of the render array. Here's an example of some other variables that don't have #access:

'site_logo' => string(35) "/drupal/core/themes/bartik/logo.svg"
'site_logo_alt' => string(0) ""
'site_logo_title' => string(0) ""
'site_name' => string(6) "Drupal"
'site_slogan' => string(0) ""

Completed Tasks

Configuration for the logo alt attribute and title attribute has been added in two cases:
1) When you use the default logo
2) When you upload your own custom logo

The system branding block has been updated to support the logo alt and logo title attributes in the Bartik, Classy and Stable themes.

Testing for saving the alt attribute and title attribute has been added in a patch in https://www.drupal.org/node/2780293#comment-12061662 (#40). Testing to ensure the alt and title attributes show in the branding block have been added in patch https://www.drupal.org/node/2780293#comment-12073031 (#45)

@rovo: has tested accessibility via Wave in #34

Feature request
Status

Needs work

Version

11.0 🔥

Component
Theme 

Last updated 6 days ago

Created by

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇨🇦Canada mgifford Ottawa, Ontario

    Looks like WCAG SC 1.1.1 may still be a problem. I have not tested if this is the case with the latest patch.

  • First commit to issue fork.
Production build 0.71.5 2024