switch shortcut form displays id (machine name) field when label field is not visible

Created on 25 September 2023, 9 months ago
Updated 29 September 2023, 9 months ago

Problem/Motivation

The switch shortcut form (/user/N/shortcuts) displays the 'id' field when the associated text field 'label' is not visible.

I first saw this in a 9.5 installation, confirmed in 10.x.dev on simplytest.me.

Steps to reproduce

On a default Drupal installation:

  1. Create a second set of shortcuts
  2. Grant 'switch shortcut sets' ("Select any shortcut set") to authenticated users
  3. Create a new user
  4. Log in as the new user
  5. Go to the new user's account page ("My account")
  6. Go to the Shortcuts tab

Currently, you see a set of radio buttons for the existing shortcut sets, and a text field named "Machine-readable name".

Proposed resolution

The 'id' machine name field is showing when the associated text field 'label' is not because in the SwitchShortcutSet form, 'label' has a #states condition that it is only visible when the 'set' field has the value "new", but 'id' does not. Adding the 'visible' condition to the 'id' field keeps it from appearing to users without permission to create a new shortcut set. For users who do have permission, the form seems to behave normally.

🐛 Bug report
Status

Needs work

Version

10.1

Component
Shortcut 

Last updated about 1 month ago

Created by

🇺🇸United States brad.bulger

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024