Problem/Motivation

The views_ui admin JavaScript requires that buttons in the interface be input elements when it is acceptable to change the markup into button elements in other places in Drupal.

The selector input.add-display is unnecessarily too strict. the add-display class is only used in views_ui module in Drupal core.

This would be a nice-to-have for people that like button elements, but it is a very minor use case because of the recent trend to direct people to use gin theme only.

Steps to reproduce

  1. Generate a starterkit custom theme
  2. Copy templates/form/input.html.twig to templates/form/input--submit.html.twig
  3. Change the markup to <button{{ attributes.setAttribute('type', 'submit') }}>{{ element['#value'] }}</button>{{ children }}, for example.
  4. Enable the theme as an administrative theme
  5. Edit a view
  6. The dropdown menu generated by views_ui/views_ui.admin library in js/views-admin.js does not generate any items.

Proposed resolution

There is already a pattern to handle something like this in views_ui module in the js/ajax.js file targeting multiple possible selectors - $form.find('input[type=submit].js-form-submit, button.js-form-submit').

We could add button.add-display as a possible selector in addition to input.add-display.

Remaining tasks

To be determined (TBD)

User interface changes

No

Introduced terminology

No

API changes

No

Data model changes

No

Release notes snippet

Issue fork drupal-3572039

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

mradcliffe created an issue. See original summary.

mradcliffe’s picture

Status: Active » Needs review

I created a merge request with the change for review for the simplest resolution.

smustgrave’s picture

Category: Task » Bug report
Status: Needs review » Reviewed & tested by the community

Summary kind of reads like a bug.

Change may be small enough to not warrant test coverage but we will see.

smustgrave’s picture

Issue tags: +Bug Smash Initiative

So part of this round of BSI we are triaging the RTBC queue to hopefully double check things are ready.

This one was small enough change, non disruptive that I think it's still good.

sivaji_ganesh_jojodae made their first commit to this issue’s fork.

  • larowlan committed 61f834bc on 11.3.x
    fix: #3572039 Add dropdown list relies on buttons being input elements...

  • larowlan committed 1b4ff506 on 11.x
    fix: #3572039 Add dropdown list relies on buttons being input elements...

  • larowlan committed 02954b2d on main
    fix: #3572039 Add dropdown list relies on buttons being input elements...
larowlan’s picture

Version: main » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed to main and backported to 11.x and 11.3.x as this is a bug and the risk of disruption is very low.
Thanks folks.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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