This module sometimes seems to cause multiple unwanted empty brackets at the start of the title element during page load (which then appear in browser tab headings). Sometimes just a single pair, sometimes lots nested like this:

( ) ) ) ) ) ) ) Foo | My Site

Could we add something to prevent that from happening? The thing is, it goes away without fail if you disable it, but I've just been looking through the source code and I can't see any javascript that updates that part of the DOM, so I'm wondering if it's impacting something else…

(Drupal 8.7.5 core)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wturrell created an issue. See original summary.

wturrell’s picture

Issue summary: View changes

(minor issue summary fix)

joco_sp’s picture

I have the same issue, but it appears only in Safari.

abhisekmazumdar’s picture

Issue summary: View changes
FileSize
403.16 KB
210.96 KB
179.18 KB

I tried to re-create this issue but wasn't able to. Sharing my configuration setup:

Tested on Safari and Chrome.

joco_sp’s picture

abhisekmazumdar it happens for users that don't have the permission to see it.
The problem is that I can't figure exactly the reason why and how it happens. For example the client always sees the (), there are even more of them like (((((((((( )))))))))). For now, I just uninstalled the module on this project, where I have those problems. Will try to test it also on the other ones and share my results.

extect’s picture

Ran into this as well. Seeing the brackets when logged in as admin. So, quite unlikely it's a permission issue. Really weird.

andy-blum’s picture

The brackets/parentheses added to document.title is coming from the tinycon repository. There are no issues on that repository about duplicate characters and after some step debugging I've been unable to replicate the issue. If anyone is still encountering this issue and is willing to share the exact values involved (environment name, document title, etc) I'd be willing to dig a bit deeper.

e0ipso’s picture

Status: Active » Closed (cannot reproduce)

Thanks for the testing everyone! I will close the issue. Let's reopen this if anyone can provide additional info to reproduce this.

miwayha’s picture

This continues to happen to me. Here's what I did:

  • Install a new version of Drupal Core (9.3.5)
  • Added Environment Indicator (4.0.3) via composer
  • Visit the site in Safari 15.2 (Mac OS 11.6.2) as user 1
  • Enabled Environment Indicator (not the UI module) via the GUI
  • Unwanted Parens in the page title immediately start appearing on all pages.
  • Create a new user and give that user Authenticated Role Only.
  • In a New Private Safari (15.2) window, log in as new user. No page title parens are present.
  • In the user 1 window, give authenticated role the "Use the Toolbar" permission. Refresh the new user window. Unwanted parens appear.
  • In the user 1 window, remove the "Use the Toolbar" permission. Refresh the new user window. Unwanted parens do not appear.
  • In the user 1 window, give "Use the Toolbar" permission to anonymous users. In the new user window, log out of the site. Unwanted parens appear.

A picture of my anonymous user screen:
Screenshot of Safari window with unwanted parentheses in title

At no point did I touch the settings.php file.
The unwanted parens do not appear for me in Chrome 98 or Firefox 96.0.3

andy-blum’s picture

Status: Closed (cannot reproduce) » Needs work

Thanks @miwayha for the replication steps! I'll take a look at this.

andy-blum’s picture

Version: 8.x-3.x-dev » 4.x-dev
andy-blum’s picture

Status: Needs work » Needs review
FileSize
8.07 KB

Thanks again @miwayha for the replication steps!

The key here was to look for it in Safari, as the tinycon library doesn't attempt to generate a new icon from the Canvas API. The attached patch makes two key changes:

  1. It utilizes the core/once library to make sure the behavior only runs once
  2. It trims the environment label of whitespace. If a label wasn't created, the module passed a blank space as the label and the tinycon lib's logic doesn't handle that well.

This patch also updates to the latest version of the TinyCon lib from https://github.com/tommoor/tinycon

e0ipso’s picture

Status: Needs review » Fixed

I do not have access to a Safari browser. But code looks good from my perspective.

e0ipso’s picture

Status: Fixed » Needs work

I just noticed this is using the new once library. Will this make this module D9.2+ only? I think we cannot afford this yet.

miwayha’s picture

I have access to Safari and can confirm the patch works as expected on a fresh install of drupal and module version 4.0.3

andy-blum’s picture

Working right now on replacing `once` with `jquery.once`. Should have a new patch shortly

andy-blum’s picture

Status: Needs work » Needs review
FileSize
8.3 KB
1.87 KB

Replaced the drupal/once library with drupal/jquery.once

  • e0ipso committed 416002f on 4.x authored by andy-blum
    Issue #3069162 by andy-blum, abhisekmazumdar, miwayha, wturrell, e0ipso...
e0ipso’s picture

Status: Needs review » Fixed

Thanks all!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.