Problem/Motivation

In #3023322: Contextual Links Style Update, we've run into some circumstances where it is beneficial to perform some formatting on screenreader-only trigger text.

Steps to reproduce

Proposed resolution

  • Add a theme function that simply returns the contextual trigger text that it is provided as an argument. This will result in no changes to how a user experiences contextual links, but it will provide themes the ability to modify the contents of the trigger text.
  • Contextual Links AuralView JavaScript should process the trigger text with this theme function.

Remaining tasks

If #3023322: Contextual Links Style Update has landed, there may be a @todo referencing this issue.

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3172956

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bnjmnm created an issue. See original summary.

bnjmnm’s picture

Issue summary: View changes
Status: Active » Needs review
Issue tags: +JavaScript
StatusFileSize
new3.25 KB

This adds+implements the theme function

bnjmnm’s picture

Title: Add theme function to processes contextual trigger text. » Add theme function to process contextual trigger text.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andrewmacpherson’s picture

I haven't really grokked the need for this yet, however...

+  /**
+   * Contextual link trigger text, typically seen only by screenreaders.
+   *

This isn't true!

The contextual trigger text is just visually hidden, which means it's rendered on the page in a way that can be accessed with other kinds of assistive technology, and likely without using any assistive technology at all.

Look what happens when you say "configuration" to Android Speech Access. Here we see the homepage after installing Standard profile, logged-in as an administrator, with the "manage" toolbar tray open. There are 10 numbers visible on screen, which are controls whose name matches "configuration". One is the visible text in the toolbar tray, and there's a column of numbers running down the right-hand side; these are the visually-hidden contextual buttons for each block.

Android screenshot shows 10 matches for the word configuration

Also, there's no reason why a custom theme can't do away with either the visually-hidden class and/or the text indent. I can imagine either of these variations being useful...

  • Buttons visible on hover/focus, but with visible label when they appear: <button type="button" class="trigger visually-hidden focusable">Configure<span class="visually-hidden"> toolbar block</span></button>
  • Permanently visible buttons (because invisible buttons are a brain hazard): <button type="button" class="trigger">Edit<span class="visually-hidden"> toolbar block</span></button>
andrewmacpherson’s picture

Status: Needs review » Needs work

So, we can ditch the comment about screen readers.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

larowlan’s picture

Issue tags: +Novice

All that remains here is to refactor the comment to remove mention of screen-readers

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Issue tags: -JavaScript +JavaScript

Believe novice tag can remain but this issue should be considered fair game for anyone.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

kieran.cott made their first commit to this issue’s fork.

kieran.cott’s picture

Status: Needs work » Needs review

Removed reference to screen-readers and implemented patch from #2 as an MR.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new976 bytes

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

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

kieran.cott’s picture

Status: Needs work » Needs review

Pipelines now pass.