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
- Generate a starterkit custom theme
- Copy
templates/form/input.html.twigtotemplates/form/input--submit.html.twig - Change the markup to
<button{{ attributes.setAttribute('type', 'submit') }}>{{ element['#value'] }}</button>{{ children }}, for example. - Enable the theme as an administrative theme
- Edit a view
- The dropdown menu generated by
views_ui/views_ui.adminlibrary injs/views-admin.jsdoes 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
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:
- 3572039-add-dropdown-allow-button
changes, plain diff MR !14672
Comments
Comment #3
mradcliffeI created a merge request with the change for review for the simplest resolution.
Comment #4
smustgrave commentedSummary kind of reads like a bug.
Change may be small enough to not warrant test coverage but we will see.
Comment #5
smustgrave commentedSo 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.
Comment #11
larowlanCommitted 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.