Problem/Motivation
Issue #3573315 added some filters on the bootstrap tab and accordion key which now renders it as an underscore instead of a key.
The clean_class filter uses \Drupal\Component\Utility\Html::getClass which calls Html::cleanCssIdentifier to sanitize the key. But this method says "Identifiers cannot start with a digit" which means the numerical tab or accordion key gets replaced with an underscore. That makes all buttons target the same invalid id instead of the expected unique numerical key based ids.
Steps to reproduce
- Create a view with a content type and fields
- Ensure title is a field and add Body or another field from the content type
- Select Bootstrap Tabs and leave it on default settings
- Inspect the bootstrap tab buttons in the view preview and see the data-bs-targets all point to the same id ending in an underscore
- Save the view, try changing tabs in Bootstrap based theme and see it not working as expected
Proposed resolution
Remove the clean_class twig filter from the accordion and tab twig files.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | views_bootstrap-3611739-remove-clean_class.diff | 1.42 KB | j_s |
Issue fork views_bootstrap-3611739
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:
- 3611739-bootstrap-tab-and
changes, plain diff MR !60
Comments
Comment #2
shelaneOr we just prepend it with a valid character? I'll have to think some more on this.
Comment #4
j_s commentedAttaching static diff.
Comment #5
j_s commentedYep, that'd work. Feel free to update MR with a different approach. For now, I just needed something to get them working again.
Comment #7
shelane